Skip to content
Draft
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
15 changes: 10 additions & 5 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
var axRange = Lib.simpleMap(ax.range, ax.r2l);
var v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction;
function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); }
ax.range = axRange.map(doZoom);
ax.range = ax._input.range = axRange.map(doZoom);
}

if(editX) {
Expand Down Expand Up @@ -613,7 +613,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {

// if l2r comes back false or undefined, it means we've dragged off
// the end of valid ranges - so stop.
if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd;
if(newEnd !== false && newEnd !== undefined) {
axi.range[end] = newEnd;
// keep ax._input.range (the user-facing layout) in sync so
// plotly_relayouting handlers reading gd.layout see fresh values
axi._input.range = axi.range.slice();
}
}
return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) /
(movedAx._rl[end] - movedAx._rl[otherEnd]);
Expand Down Expand Up @@ -710,7 +715,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
out[ax._name + '.range[0]'] = out[ax2._name + '.range[0]'];
out[ax._name + '.range[1]'] = out[ax2._name + '.range[1]'];
} else {
ax.range = ax2.range.slice();
ax.range = ax._input.range = ax2.range.slice();
}
}
}
Expand Down Expand Up @@ -1120,12 +1125,12 @@ function dragAxList(axList, pix) {
var d1 = axi.p2l(p1 + pix) - axi.p2l(p1);
var delta = (d0 + d1) / 2;

axi.range = [
axi.range = axi._input.range = [
axi.l2r(axi._rl[0] - delta),
axi.l2r(axi._rl[1] - delta)
];
} else {
axi.range = [
axi.range = axi._input.range = [
axi.l2r(axi._rl[0] - pix / axi._m),
axi.l2r(axi._rl[1] - pix / axi._m)
];
Expand Down