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,16 +666,19 @@ 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 (dragging || new Rectangle(new Point(),
view.getViewSize()).contains(point)) {
if (view._onMouseMove) if (view._onMouseMove)
view._onMouseMove(event, point); view._onMouseMove(event, point);
if (tool = view._scope._tool) { if (tool = view._scope._tool) {
// If there's no onMouseDrag, fire onMouseMove while dragging too. // If there's no onMouseDrag, fire onMouseMove while dragging.
if (tool._onHandleEvent(dragging && tool.responds('mousedrag') if (tool._onHandleEvent(dragging && tool.responds('mousedrag')
? 'mousedrag' : 'mousemove', point, event)) ? 'mousedrag' : 'mousemove', point, event))
DomEvent.stop(event); DomEvent.stop(event);
} }
view.draw(true); view.draw(true);
} }
}
function mouseup(event) { function mouseup(event) {
var view = View._focused; var view = View._focused;