Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register mousemove as non passive to help touch devices #4933

Merged
merged 3 commits into from
Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build": "node build.js modules=ALL requirejs exclude=gestures,accessors",
"build:fast": "node build.js modules=ALL requirejs fast exclude=gestures,accessors",
"build:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm run build_export",
"build_with_gestures": "node build.js modules=ALL exclude=json",
"build_with_gestures": "node build.js modules=ALL exclude=accessors",
"build_export": "npm run build:fast && npm run export_dist_to_site",
"test": "node test.js",
"lint": "eslint --config .eslintrc.json src",
Expand Down
2 changes: 1 addition & 1 deletion src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@
height: height + 'px',
left: 0,
top: 0,
'touch-action': 'none'
'touch-action': this.allowTouchScrolling ? 'manipulation' : 'none'
});
element.width = width;
element.height = height;
Expand Down
8 changes: 4 additions & 4 deletions src/mixins/canvas_events.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
// mouse events
addListener(this.upperCanvasEl, 'mousedown', this._onMouseDown);
addListener(this.upperCanvasEl, 'dblclick', this._onDoubleClick);
addListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
addListener(this.upperCanvasEl, 'mousemove', this._onMouseMove, addEventOptions);
addListener(this.upperCanvasEl, 'mouseout', this._onMouseOut);
addListener(this.upperCanvasEl, 'mouseenter', this._onMouseEnter);
addListener(this.upperCanvasEl, 'wheel', this._onMouseWheel);
Expand Down Expand Up @@ -255,7 +255,7 @@
addListener(fabric.document, 'touchmove', this._onMouseMove, addEventOptions);

removeListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
removeListener(this.upperCanvasEl, 'touchmove', this._onMouseMove, addEventOptions);
removeListener(this.upperCanvasEl, 'touchmove', this._onMouseMove);

if (e.type === 'touchstart') {
// Unbind mousedown to prevent double triggers from touch devices
Expand All @@ -278,9 +278,9 @@
removeListener(fabric.document, 'touchend', this._onMouseUp, addEventOptions);

removeListener(fabric.document, 'mousemove', this._onMouseMove);
removeListener(fabric.document, 'touchmove', this._onMouseMove, addEventOptions);
removeListener(fabric.document, 'touchmove', this._onMouseMove);

addListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
addListener(this.upperCanvasEl, 'mousemove', this._onMouseMove, addEventOptions);
addListener(this.upperCanvasEl, 'touchmove', this._onMouseMove, addEventOptions);

if (e.type === 'touchend') {
Expand Down