10000 make 3d drag modebar button update scene.dragmode, · timelyportfolio/plotly.js@1180a8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1180a8f

Browse files
committed
make 3d drag modebar button update scene.dragmode,
instead of layout.dragmode
1 parent 760bda3 commit 1180a8f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/components/modebar/buttons.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function handleCartesian(gd, ev) {
267267
modeBarButtons.zoom3d = {
268268
name: 'zoom3d',
269269
title: 'Zoom',
270-
attr: 'dragmode',
270+
attr: 'scene.dragmode',
271271
val: 'zoom',
272272
icon: Icons.zoombox,
273273
click: handleDrag3d
@@ -276,7 +276,7 @@ modeBarButtons.zoom3d = {
276276
modeBarButtons.pan3d = {
277277
name: 'pan3d',
278278
title: 'Pan',
279-
attr: 'dragmode',
279+
attr: 'scene.dragmode',
280280
val: 'pan',
281281
icon: Icons.pan,
282282
click: handleDrag3d
@@ -285,7 +285,7 @@ modeBarButtons.pan3d = {
285285
modeBarButtons.orbitRotation = {
286286
name: 'orbitRotation',
287287
title: 'orbital rotation',
288-
attr: 'dragmode',
288+
attr: 'scene.dragmode',
289289
val: 'orbit',
290290
icon: Icons['3d_rotate'],
291291
click: handleDrag3d
@@ -294,7 +294,7 @@ modeBarButtons.orbitRotation = {
294294
modeBarButtons.tableRotation = {
295295
name: 'tableRotation',
296296
title: 'turntable rotation',
297-
attr: 'dragmode',
297+
attr: 'scene.dragmode',
298298
val: 'turntable',
299299
icon: Icons['z-axis'],
300300
click: handleDrag3d
@@ -304,14 +304,16 @@ function handleDrag3d(gd, ev) {
304304
var button = ev.currentTarget,
305305
attr = button.getAttribute('data-attr'),
306306
val = button.getAttribute('data-val') || true,
307+
fullLayout = gd._fullLayout,
308+
sceneIds = Plotly.Plots.getSubplotIds(fullLayout, 'gl3d'),
307309
layoutUpdate = {};
308310

309-
layoutUpdate[attr] = val;
311+
var parts = attr.split('.');
312+
313+
for(var i = 0; i < sceneIds.length; i++) {
314+
layoutUpdate[sceneIds[i] + '.' + parts[1]] = val;
315+
}
310316

311-
/*
312-
* Dragmode will go through the relayout -> doplot -> scene.plot()
313-
* routine where the dragmode will be set in scene.plot()
314-
*/
315317
Plotly.relayout(gd, layoutUpdate);
316318
}
317319

0 commit comments

Comments
 (0)
0