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:
Jürg Lehni 2013-12-03 22:25:04 +01:00
parent 5f24bf8da5
commit c423fcda39

View file

@ -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) {