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