Skip to content

Commit 8a57ba1

Browse files
committed
add false value to scene.dragmode
- to remove drag interactions from a given gl3d scene
1 parent 8269ea0 commit 8a57ba1

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/plots/gl3d/camera.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,13 @@ function createCamera(element, options) {
181181

182182
var lastX = 0, lastY = 0;
183183
mouseChange(element, function(buttons, x, y, mods) {
184-
var rotate = camera.keyBindingMode === 'rotate';
185-
var pan = camera.keyBindingMode === 'pan';
186-
var zoom = camera.keyBindingMode === 'zoom';
184+
var keyBindingMode = camera.keyBindingMode;
185+
186+
if(keyBindingMode === false) return;
187+
188+
var rotate = keyBindingMode === 'rotate';
189+
var pan = keyBindingMode === 'pan';
190+
var zoom = keyBindingMode === 'zoom';
187191

188192
var ctrl = !!mods.control;
189193
var alt = !!mods.alt;
@@ -226,6 +230,8 @@ function createCamera(element, options) {
226230
});
227231

228232
mouseWheel(element, function(dx, dy) {
233+
if(camera.keyBindingMode === false) return;
234+
229235
var flipX = camera.flipX ? 1 : -1;
230236
var flipY = camera.flipY ? 1 : -1;
231237
var t = now();

src/plots/gl3d/layout/layout_attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ module.exports = {
142142
dragmode: {
143143
valType: 'enumerated',
144144
role: 'info',
145-
values: ['orbit', 'turntable', 'zoom', 'pan'],
145+
values: ['orbit', 'turntable', 'zoom', 'pan', false],
146146
dflt: 'turntable',
147147
description: [
148148
'Determines the mode of drag interactions for this scene.'

src/plots/gl3d/scene.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) {
173173
}
174174

175175
var relayoutCallback = function(scene) {
176+
if(scene.fullSceneLayout.dragmode === false) return;
177+
176178
var update = {};
177179
update[scene.id] = getLayoutCamera(scene.camera);
178180
scene.saveCamera(scene.graphDiv.layout);

0 commit comments

Comments
 (0)