Skip to content

Commit 25482da

Browse files
authored
Don't apply relayout operations to the view that originated the event (GH1086) (plotly#1094)
* Don't apply relayout operations to the view that originated the event This fixes a zoom stutter that occurred on scroll zoom of 3d plots * When computing overlapping properties to remove, don't leave empty objects. Before, while scroll zooming on scatter3d trace with multiple views we'd sometimes end up with a _props state of: {'up': {'x': -0.4, 'y': -0.4, 'z': 0.8}, 'center': {'x': 0, 'y': 0, 'z': 0}, 'eye': {}} When this happened, accessing a sub-property of eye would always return none, even though values existed in the _prop_defaults dict. e.g. fig.layout.scene.camera.eye.x would return None because the eye dict in _props was empty. Now we just remove the eye property as well if all of it's own properties have been removed: {'up': {'x': -0.4, 'y': -0.4, 'z': 0.8}, 'center': {'x': 0, 'y': 0, 'z': 0}}
1 parent 313129b commit 25482da

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Diff for: js/src/Figure.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,11 @@ var FigureView = widgets.DOMWidgetView.extend({
12481248
/** @type {Py2JsRelayoutMsg} */
12491249
var msgData = this.model.get("_py2js_relayout");
12501250
if (msgData !== null) {
1251-
1252-
var relayoutData = msgData.relayout_data;
1251+
if (msgData.source_view_id !== this.viewID) {
1252+
var relayoutData = msgData.relayout_data;
12531253
relayoutData["_doNotReportToPy"] = true;
12541254
Plotly.relayout(this.el, msgData.relayout_data);
1255+
}
12551256

12561257
// ### Send layout delta ###
12571258
var layout_edit_id = msgData.layout_edit_id;

Diff for: plotly/basewidget.py

+6
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,12 @@ def _remove_overlapping_props(input_data, delta_data, prop_path=()):
814814
input_val, delta_val, recur_prop_path))
815815
removed.extend(recur_removed)
816816

817+
# Check whether the last property in input_val
818+
# has been removed. If so, remove it entirely
819+
if not input_val:
820+
input_data.pop(p)
821+
removed.append(recur_prop_path)
822+
817823
elif p in input_data and p != 'uid':
818824
# ### Remove property ###
819825
input_data.pop(p)

0 commit comments

Comments
 (0)