mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Fix: calling event.preventDefault() on not cancelable events produces errors
This commit is contained in:
parent
cb9fbd7789
commit
54e1a0c1ef
1 changed files with 5 additions and 1 deletions
|
@ -1440,7 +1440,11 @@ new function() { // Injection scope for event handling on the browser
|
|||
// which can call `preventDefault()` explicitly or return `false`.
|
||||
// - If this is a unhandled mousedown event, but the view or tools
|
||||
// respond to mouseup.
|
||||
if (called && !mouse.move || mouse.down && responds('mouseup'))
|
||||
//
|
||||
// Some events are not cancelable anyway (like during a scroll inertia
|
||||
// on mobile) so trying to prevent default in those case would result
|
||||
// in no effect and an error.
|
||||
if (event.cancelable !== false && (called && !mouse.move || mouse.down && responds('mouseup')))
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue