Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 86b90d4

Browse files
committed
remove apply arg from _storeDirectGUIEdit
1 parent 54304b4 commit 86b90d4

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/plot_api/plot_api.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,22 +1438,21 @@ function storeCurrent(attr, val, newVal, preGUI) {
14381438
}
14391439
}
14401440

1441-
/*
1441+
/**
14421442
* storeDirectGUIEdit: for routines that skip restyle/relayout and mock it
14431443
* by emitting a plotly_restyle or plotly_relayout event, this routine
1444-
* applies the changes to the input objects and keeps track of the initial state
1445-
* in _preGUI for use by uirevision
1444+
* keeps track of the initial state in _preGUI for use by uirevision
1445+
* Does *not* apply these changes to data/layout - that's the responsibility
1446+
* of the calling routine.
14461447
*
14471448
* @param {object} container: the input attributes container (eg `layout` or a `trace`)
14481449
* @param {object} fullContainer: the full partner to `container`
14491450
* @param {object} edits: the {attr: val} object as normally passed to `relayout` etc
1450-
* @param {boolean} apply: should we apply these changes to the input object?
14511451
*/
1452-
exports._storeDirectGUIEdit = function(container, preGUI, edits, apply) {
1452+
exports._storeDirectGUIEdit = function(container, preGUI, edits) {
14531453
for(var attr in edits) {
14541454
var np = nestedProperty(container, attr);
14551455
storeCurrent(attr, np.get(), edits[attr], preGUI);
1456-
if(apply) np.set(edits[attr]);
14571456
}
14581457
};
14591458

src/plots/gl2d/scene2d.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,25 @@ proto.relayoutCallback = function() {
316316
var graphDiv = this.graphDiv;
317317
var xaxis = this.xaxis;
318318
var yaxis = this.yaxis;
319+
var layout = graphDiv.layout;
319320

320321
// make a meaningful value to be passed on to possible 'plotly_relayout' subscriber(s)
321322
var update = {};
322-
update[xaxis._name + '.range'] = xaxis.range.slice();
323-
update[yaxis._name + '.range'] = yaxis.range.slice();
323+
var xrange = update[xaxis._name + '.range'] = xaxis.range.slice();
324+
var yrange = update[yaxis._name + '.range'] = yaxis.range.slice();
324325
update[xaxis._name + '.autorange'] = xaxis.autorange;
325326
update[yaxis._name + '.autorange'] = yaxis.autorange;
326327

327-
Registry.call('_storeDirectGUIEdit', graphDiv.layout, graphDiv._fullLayout._preGUI, update, true);
328+
Registry.call('_storeDirectGUIEdit', graphDiv.layout, graphDiv._fullLayout._preGUI, update);
329+
330+
// update the input layout
331+
var xaIn = layout[xaxis._name];
332+
xaIn.range = xrange;
333+
xaIn.autorange = xaxis.autorange;
334+
335+
var yaIn = layout[yaxis._name];
336+
yaIn.range = yrange;
337+
yaIn.autorange = yaxis.autorange;
328338

329339
// lastInputTime helps determine which one is the latest input (if async)
330340
update.lastInputTime = this.camera.lastInputTime;

0 commit comments

Comments
 (0)