-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make scrollZoom config option a flaglist #3422
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
Changes from all commits
c83538a
b56591d
26618dd
16a01e7
09f1af5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,8 +227,15 @@ function initializeGLPlot(scene, canvas, gl) { | |
scene.graphDiv.emit('plotly_relayout', update); | ||
}; | ||
|
||
scene.glplot.canvas.addEventListener('mouseup', relayoutCallback.bind(null, scene)); | ||
scene.glplot.canvas.addEventListener('wheel', relayoutCallback.bind(null, scene), passiveSupported ? {passive: false} : false); | ||
scene.glplot.canvas.addEventListener('mouseup', function() { | ||
relayoutCallback(scene); | ||
}); | ||
|
||
scene.glplot.canvas.addEventListener('wheel', function() { | ||
if(gd._context._scrollZoom.gl3d) { | ||
relayoutCallback(scene); | ||
} | ||
}, passiveSupported ? {passive: false} : false); | ||
Comment on lines
+234
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've disabled scrollZoom in the plot config, but the mouse is still getting captured when scrolling by the canvas. Looks like it's because of the wheel event listener that's being registered here anyway. After I remove the wheel listener on scene element from chrome inspector, scrolling the page no longer gets captured by the canvas. @etpinard, can we not add the listener at all if scrollzoom is disabled? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zfei thanks for the debugging. This comment is going to get lost here on a merged PR though, can you make a new issue for this? Or better yet a PR, looks like it's probably a pretty easy fix 😎 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @alexcjohnson. I've never touched the Plotly codebase and haven't set up my mind to go through the learning curve yet. 😉 Will just leave it as an issue for now. |
||
|
||
if(!scene.staticMode) { | ||
scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { | ||
|
@@ -385,7 +392,6 @@ function computeTraceBounds(scene, trace, bounds) { | |
} | ||
|
||
proto.plot = function(sceneData, fullLayout, layout) { | ||
|
||
// Save parameters | ||
this.plotArgs = [sceneData, fullLayout, layout]; | ||
|
||
|
@@ -412,6 +418,7 @@ proto.plot = function(sceneData, fullLayout, layout) { | |
// Update camera and camera mode | ||
this.setCamera(fullSceneLayout.camera); | ||
this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode); | ||
this.camera.enableWheel = this.graphDiv._context._scrollZoom.gl3d; | ||
|
||
// Update scene | ||
this.glplot.update({}); | ||
|
@@ -776,7 +783,6 @@ proto.updateFx = function(dragmode, hovermode) { | |
fullCamera.up = zUp; | ||
Lib.nestedProperty(layout, attr).set(zUp); | ||
} else { | ||
|
||
// none rotation modes [pan or zoom] | ||
camera.keyBindingMode = dragmode; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.