Skip to content

Commit

Permalink
Update _fireOverOutEvents to pass event object (#3853)
Browse files Browse the repository at this point in the history
I encountered a scenario where we were listening for `mouseout` and calling `_isObjectMoved` expecting an event object to be passed from the `mouseout` listener, however the object was not passed from `_fireOverOutEvents`. Normally this would not be an issue as `_isObjectMoved()` -> `getPointer()` checks for `fabric.window.event` and uses that if `event` is undefined, but this produces an error in Firefox as the `window.event` property is not implemented (https://developer.mozilla.org/en-US/docs/Web/API/Window/event).

To resolve this I am proposing that `_fireOverOutEvents` pass along the event object to the target so that it can be passed along to `isObjectMoved()` if necessary.
  • Loading branch information
rhoffmann8 authored and asturur committed Apr 20, 2017
1 parent de39c3c commit 6dd4b70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,16 +1136,16 @@
if (this._hoveredTarget !== target) {
if (this._hoveredTarget) {
this.fire('mouse:out', { target: this._hoveredTarget, e: e });
this._hoveredTarget.fire('mouseout');
this._hoveredTarget.fire('mouseout', { e: e });
}
this.fire('mouse:over', { target: target, e: e });
target.fire('mouseover');
target.fire('mouseover', { e: e });
this._hoveredTarget = target;
}
}
else if (this._hoveredTarget) {
this.fire('mouse:out', { target: this._hoveredTarget, e: e });
this._hoveredTarget.fire('mouseout');
this._hoveredTarget.fire('mouseout', { e: e });
this._hoveredTarget = null;
}
},
Expand Down

0 comments on commit 6dd4b70

Please sign in to comment.