mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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))
|
if (!(view = view || View._focused))
|
||||||
return;
|
return;
|
||||||
var point = event && viewToProject(view, event);
|
var point = event && viewToProject(view, event);
|
||||||
if (view._onMouseMove)
|
if (dragging || new Rectangle(new Point(),
|
||||||
view._onMouseMove(event, point);
|
view.getViewSize()).contains(point)) {
|
||||||
if (tool = view._scope._tool) {
|
if (view._onMouseMove)
|
||||||
// If there's no onMouseDrag, fire onMouseMove while dragging too.
|
view._onMouseMove(event, point);
|
||||||
if (tool._onHandleEvent(dragging && tool.responds('mousedrag')
|
if (tool = view._scope._tool) {
|
||||||
? 'mousedrag' : 'mousemove', point, event))
|
// If there's no onMouseDrag, fire onMouseMove while dragging.
|
||||||
DomEvent.stop(event);
|
if (tool._onHandleEvent(dragging && tool.responds('mousedrag')
|
||||||
|
? 'mousedrag' : 'mousemove', point, event))
|
||||||
|
DomEvent.stop(event);
|
||||||
|
}
|
||||||
|
view.draw(true);
|
||||||
}
|
}
|
||||||
view.draw(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseup(event) {
|
function mouseup(event) {
|
||||||
|
|
Loading…
Reference in a new issue