passivefalseeverywhere (#3690)

* passivefalseeverywhere

* Update canvas_events.mixin.js

* Update dom_event.js

* Update canvas.class.js
This commit is contained in:
Andrea Bogazzi 2017-02-13 23:35:35 -05:00 committed by GitHub
parent 91c851a333
commit 7ff1063c07
3 changed files with 11 additions and 9 deletions

View file

@ -1312,7 +1312,8 @@
width: width + 'px',
height: height + 'px',
left: 0,
top: 0
top: 0,
'touch-action': 'none'
});
element.width = width;
element.height = height;

View file

@ -49,8 +49,8 @@
addListener(this.upperCanvasEl, 'contextmenu', this._onContextMenu);
// touch events
addListener(this.upperCanvasEl, 'touchstart', this._onMouseDown);
addListener(this.upperCanvasEl, 'touchmove', this._onMouseMove);
addListener(this.upperCanvasEl, 'touchstart', this._onMouseDown, { passive: false });
addListener(this.upperCanvasEl, 'touchmove', this._onMouseMove, { passive: false });
if (typeof eventjs !== 'undefined' && 'add' in eventjs) {
eventjs.add(this.upperCanvasEl, 'gesture', this._onGesture);
@ -199,7 +199,7 @@
_onMouseDown: function (e) {
this.__onMouseDown(e);
addListener(fabric.document, 'touchend', this._onMouseUp);
addListener(fabric.document, 'touchend', this._onMouseUp, { passive: false });
addListener(fabric.document, 'touchmove', this._onMouseMove, { passive: false });
removeListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
@ -229,7 +229,7 @@
removeListener(fabric.document, 'touchmove', this._onMouseMove);
addListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
addListener(this.upperCanvasEl, 'touchmove', this._onMouseMove);
addListener(this.upperCanvasEl, 'touchmove', this._onMouseMove, { passive: false });
if (e.type === 'touchend') {
// Wait 400ms before rebinding mousedown to prevent double triggers

View file

@ -80,12 +80,13 @@
if (shouldUseAddListenerRemoveListener) {
/** @ignore */
addListener = function (element, eventName, handler) {
element.addEventListener(eventName, handler, false);
addListener = function (element, eventName, handler, options) {
// since ie10 or ie9 can use addEventListener but they do not support options, i need to check
element.addEventListener(eventName, handler, shouldUseAttachEventDetachEvent ? false : options);
};
/** @ignore */
removeListener = function (element, eventName, handler) {
element.removeEventListener(eventName, handler, false);
removeListener = function (element, eventName, handler, options) {
element.removeEventListener(eventName, handler, shouldUseAttachEventDetachEvent ? false : options);
};
}