Skip to content

Commit e0d05f6

Browse files
committed
gl2d: un-set axis autorange after interactions
1 parent 716f2cd commit e0d05f6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/plots/gl2d/camera.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ function createCamera(scene) {
3232
plot = scene.glplot,
3333
result = new Camera2D(element, plot);
3434

35+
function unSetAutoRange() {
36+
scene.xaxis.autorange = false;
37+
scene.yaxis.autorange = false;
38+
}
39+
3540
result.mouseListener = mouseChange(element, function(buttons, x, y) {
3641
var xrange = scene.xaxis.range,
3742
yrange = scene.yaxis.range,
@@ -84,7 +89,7 @@ function createCamera(scene) {
8489
else if(result.boxEnabled) {
8590
updateRange(xrange, result.boxStart[0], result.boxEnd[0]);
8691
updateRange(yrange, result.boxStart[1], result.boxEnd[1]);
87-
92+
unSetAutoRange();
8893
result.boxEnabled = false;
8994
}
9095
break;
@@ -104,7 +109,7 @@ function createCamera(scene) {
104109
yrange[1] += dy;
105110

106111
result.lastInputTime = Date.now();
107-
112+
unSetAutoRange();
108113
scene.cameraChanged();
109114
}
110115
break;
@@ -142,6 +147,7 @@ function createCamera(scene) {
142147
yrange[1] = (yrange[1] - cy) * scale + cy;
143148

144149
result.lastInputTime = Date.now();
150+
unSetAutoRange();
145151
scene.cameraChanged();
146152
break;
147153
}

src/plots/gl2d/scene2d.js

+2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ var relayoutCallback = function(scene) {
275275
yrange = scene.yaxis.range;
276276

277277
// Update the layout on the DIV
278+
scene.graphDiv.layout.xaxis.autorange = scene.xaxis.autorange;
278279
scene.graphDiv.layout.xaxis.range = xrange.slice(0);
280+
scene.graphDiv.layout.yaxis.autorange = scene.yaxis.autorange;
279281
scene.graphDiv.layout.yaxis.range = yrange.slice(0);
280282

281283
// Make a meaningful value to be passed on to the possible 'plotly_relayout' subscriber(s)

0 commit comments

Comments
 (0)