mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Only handle and fire mousemove events when the user's either dragging or moving the mouse within the view.
Fixes #352.
This commit is contained in:
parent
5f24bf8da5
commit
c423fcda39
1 changed files with 11 additions and 8 deletions
|
@ -666,15 +666,18 @@ var View = Base.extend(Callback, /** @lends View# */{
|
|||
if (!(view = view || View._focused))
|
||||
return;
|
||||
var point = event && viewToProject(view, event);
|
||||
if (view._onMouseMove)
|
||||
view._onMouseMove(event, point);
|
||||
if (tool = view._scope._tool) {
|
||||
// If there's no onMouseDrag, fire onMouseMove while dragging too.
|
||||
if (tool._onHandleEvent(dragging && tool.responds('mousedrag')
|
||||
? 'mousedrag' : 'mousemove', point, event))
|
||||
DomEvent.stop(event);
|
||||
if (dragging || new Rectangle(new Point(),
|
||||
view.getViewSize()).contains(point)) {
|
||||
if (view._onMouseMove)
|
||||
view._onMouseMove(event, point);
|
||||
if (tool = view._scope._tool) {
|
||||
// If there's no onMouseDrag, fire onMouseMove while dragging.
|
||||
if (tool._onHandleEvent(dragging && tool.responds('mousedrag')
|
||||
? 'mousedrag' : 'mousemove', point, event))
|
||||
DomEvent.stop(event);
|
||||
}
|
||||
view.draw(true);
|
||||
}
|
||||
view.draw(true);
|
||||
}
|
||||
|
||||
function mouseup(event) {
|
||||
|
|
Loading…
Reference in a new issue