Skip to content

Commit 9f3d14e

Browse files
committed
store previous scene state in button obj,
instead of in JSON stringify/parse via the DOM element.
1 parent 4babccb commit 9f3d14e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/modebar/buttons.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ modeBarButtons.hoverClosest3d = {
364364

365365
function handleHover3d(gd, ev) {
366366
var button = ev.currentTarget,
367-
val = JSON.parse(button.getAttribute('data-val')) || false,
367+
val = button._previousVal || false,
368368
layout = gd.layout,
369369
fullLayout = gd._fullLayout,
370370
sceneIds = Plotly.Plots.getSubplotIds(fullLayout, 'gl3d');
@@ -379,7 +379,7 @@ function handleHover3d(gd, ev) {
379379

380380
if(val) {
381381
layoutUpdate = Lib.extendDeep(layout, val);
382-
button.setAttribute('data-val', JSON.stringify(null));
382+
button._previousVal = null;
383383
}
384384
else {
385385
layoutUpdate = {
@@ -406,7 +406,7 @@ function handleHover3d(gd, ev) {
406406
}
407407
}
408408

409-
button.setAttribute('data-val', JSON.stringify(currentSpikes));
409+
button._previousVal = Lib.extendDeep({}, currentSpikes);
410410
}
411411

412412
Plotly.relayout(gd, layoutUpdate);

0 commit comments

Comments
 (0)