Skip to content

Commit 144325b

Browse files
author
Jon M. Mease
committed
Return trace/layout deltas for do_* operations even if source_view_id matches
1 parent 0eeaaa5 commit 144325b

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

js/src/Figure.js

+30-24
Original file line numberDiff line numberDiff line change
@@ -1245,15 +1245,13 @@ var FigureView = widgets.DOMWidgetView.extend({
12451245
if (msgData.source_view_id === this.viewID) {
12461246
// Operation originated from this view, don't re-apply it
12471247
console.log("Skipping relayout for view " + this.viewID);
1248-
return
12491248
} else {
12501249
console.log("Applying relayout for view " + this.viewID);
1251-
}
1252-
1253-
var relayoutData = msgData.relayout_data;
12541250

1255-
relayoutData["_doNotReportToPy"] = true;
1256-
Plotly.relayout(this.el, msgData.relayout_data);
1251+
var relayoutData = msgData.relayout_data;
1252+
relayoutData["_doNotReportToPy"] = true;
1253+
Plotly.relayout(this.el, msgData.relayout_data);
1254+
}
12571255

12581256
// ### Send layout delta ###
12591257
var layout_edit_id = msgData.layout_edit_id;
@@ -1279,13 +1277,12 @@ var FigureView = widgets.DOMWidgetView.extend({
12791277
if (msgData.source_view_id === this.viewID) {
12801278
// Operation originated from this view, don't re-apply it
12811279
console.log("Skipping update for view " + this.viewID);
1282-
return
12831280
} else {
12841281
console.log("Applying update for view " + this.viewID)
1285-
}
12861282

1287-
style["_doNotReportToPy"] = true;
1288-
Plotly.update(this.el, style, layout, traceIndexes);
1283+
style["_doNotReportToPy"] = true;
1284+
Plotly.update(this.el, style, layout, traceIndexes);
1285+
}
12891286

12901287
// ### Send trace deltas ###
12911288
// We create an array of deltas corresponding to the updated
@@ -1327,26 +1324,35 @@ var FigureView = widgets.DOMWidgetView.extend({
13271324
if (msgData.source_view_id === this.viewID) {
13281325
// Operation originated from this view, don't re-apply it
13291326
console.log("Skipping animate for view " + this.viewID);
1330-
return
1327+
1328+
// ### Send trace deltas ###
1329+
// We create an array of deltas corresponding to the
1330+
// animated traces.
1331+
this._sendTraceDeltas(traceIndexes, msgData.trace_edit_id);
1332+
1333+
// ### Send layout delta ###
1334+
var layout_edit_id = msgData.layout_edit_id;
1335+
this._sendLayoutDelta(layout_edit_id);
1336+
13311337
} else {
13321338
console.log("Applying animate for view " + this.viewID)
1333-
}
13341339

1335-
animationData["_doNotReportToPy"] = true;
1336-
var that = this;
1340+
animationData["_doNotReportToPy"] = true;
1341+
var that = this;
13371342

1338-
Plotly.animate(this.el, animationData, animationOpts).then(
1339-
function () {
1343+
Plotly.animate(this.el, animationData, animationOpts).then(
1344+
function () {
13401345

1341-
// ### Send trace deltas ###
1342-
// We create an array of deltas corresponding to the
1343-
// animated traces.
1344-
that._sendTraceDeltas(traceIndexes, msgData.trace_edit_id);
1346+
// ### Send trace deltas ###
1347+
// We create an array of deltas corresponding to the
1348+
// animated traces.
1349+
that._sendTraceDeltas(traceIndexes, msgData.trace_edit_id);
13451350

1346-
// ### Send layout delta ###
1347-
var layout_edit_id = msgData.layout_edit_id;
1348-
that._sendLayoutDelta(layout_edit_id);
1349-
});
1351+
// ### Send layout delta ###
1352+
var layout_edit_id = msgData.layout_edit_id;
1353+
that._sendLayoutDelta(layout_edit_id);
1354+
});
1355+
}
13501356
}
13511357
},
13521358

0 commit comments

Comments
 (0)