paperjs / paper.js

The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey
http://paperjs.org
Other
14.45k stars 1.22k forks source link

Allow for a way to prevent `event.preventDefault()` on View mouseDown events #1429

Closed iMoses closed 5 years ago

iMoses commented 6 years ago

I have a project in which I'm using paper.js alongside a library which also uses the canvas element for managing keyboard shortcuts, focus, etc.

It seems that if I use the View's mouseDown event, preventDefault() will automatically be called, and there's no option to override this behavior, which is needed for handling context-menus, for example.

In the meanwhile, any suggestions on how to keep the event's default behavior?

https://github.com/paperjs/paper.js/blob/caa93a51cab12be0e5648c60268dac9914f4541d/src/view/View.js#L1183-L1184

sasensi commented 5 years ago

Hi, could you provide a live code example of a failing case ? I tried to reproduce the issue in this fiddle but it is actually working as expected (look in the console). Anyway, on the latest version, thanks to this change 54e1a0c1efbe05ea0c3b5437867853976d074530, you can take advantage of event.cancelable, setting it to false, to keep the event default behaviour.

sasensi commented 5 years ago

I close this issue for lack of feedback. It will be reopened if more information is provided.