Skip to content

Commit 99101fe

Browse files
committed
1/2 zoom speed for all and disableable zoom in scattergl
1 parent e489a72 commit 99101fe

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/plots/cartesian/dragbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
380380
return;
381381
}
382382

383-
var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 100),
383+
var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 200),
384384
gbb = mainplot.draglayer.select('.nsewdrag')
385385
.node().getBoundingClientRect(),
386386
xfrac = (e.clientX - gbb.left) / gbb.width,

src/plots/gl2d/camera.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,15 @@ function createCamera(scene) {
256256
}
257257

258258
result.wheelListener = mouseWheel(element, function(dx, dy) {
259+
if (!scene.scrollZoom) return false;
260+
259261
var dataBox = scene.calcDataBox(),
260262
viewBox = plot.viewBox;
261263

262264
var lastX = result.lastPos[0],
263265
lastY = result.lastPos[1];
264266

265-
var scale = Math.exp(10.0 * dy / (viewBox[3] - viewBox[1]));
267+
var scale = Math.exp(5.0 * dy / (viewBox[3] - viewBox[1]));
266268

267269
var cx = lastX /
268270
(viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) +

src/plots/gl2d/scene2d.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function Scene2D(options, fullLayout) {
3636
this.pixelRatio = options.plotGlPixelRatio || window.devicePixelRatio;
3737
this.id = options.id;
3838
this.staticPlot = !!options.staticPlot;
39+
this.scrollZoom = this.graphDiv._context.scrollZoom;
3940

4041
this.fullData = null;
4142
this.updateRefs(fullLayout);

src/plots/gl3d/camera.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function createCamera(element, options) {
256256
if(Math.abs(dx) > Math.abs(dy)) {
257257
view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth);
258258
} else {
259-
var kzoom = -camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 10.0;
259+
var kzoom = -camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 20.0;
260260
view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1));
261261
}
262262
}, true);

0 commit comments

Comments
 (0)