You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add handling 'mouse:up' event to canvas, run code on touchable device, every 'mousedown' event causes adding handler for 'touchend' event, and it is not removed,
removeListener shoud be called with the same options as addListener
otherwise the handler is not removed. What is more we need to call it with the same options object:
Steps to reproduce
Add handling 'mouse:up' event to canvas, run code on touchable device, every 'mousedown' event causes adding handler for 'touchend' event, and it is not removed,
The reason is this code:
_onMouseDown: function(e) {
this.__onMouseDown(e);
addListener(fabric.document, "touchend", this._onMouseUp, {
passive: false
});
# addListener(fabric.document, "touchmove", this._onMouseMove, {
passive: false
});
removeListener(this.upperCanvasEl, "mousemove", this._onMouseMove);
removeListener(this.upperCanvasEl, "touchmove", this._onMouseMove);
if (e.type === "touchstart") {
removeListener(this.upperCanvasEl, "mousedown", this._onMouseDown);
} else {
addListener(fabric.document, "mouseup", this._onMouseUp);
addListener(fabric.document, "mousemove", this._onMouseMove);
}
},
_onMouseUp: function(e) {
this.__onMouseUp(e);
removeListener(fabric.document, "mouseup", this._onMouseUp);
removeListener shoud be called with the same options as addListener
otherwise the handler is not removed. What is more we need to call it with the same options object:
This won't work:
addListener(fabric.document, "touchend", this._onMouseUp, {
passive: false
});
removeListener(fabric.document, "touchend", this._onMouseUp, {
passive: false
});
# this will work
var options = {
passive: false
}
*addListener(fabric.document, "touchend", this._onMouseUp, options);
removeListener(fabric.document, "touchend", this._onMouseUp, options);
It is a little bit strange:)
The text was updated successfully, but these errors were encountered: