Skip to content

Commit 82604eb

Browse files
committed
added tabletmode to fire plotly_click event for mobile devices.
1 parent 3f8cfe7 commit 82604eb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/plots/gl3d/scene.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ var computeTickMarks = require('./layout/tick_marks');
2424

2525
var STATIC_CANVAS, STATIC_CONTEXT;
2626

27+
var tabletmode = false;
28+
2729
function Scene(options, fullLayout) {
2830
// create sub container for plot
2931
var sceneContainer = document.createElement('div');
@@ -241,6 +243,10 @@ proto.initializeGLPlot = function() {
241243
relayoutCallback(scene);
242244
});
243245

246+
scene.glplot.canvas.addEventListener('touchstart', function() {
247+
tabletmode = true;
248+
});
249+
244250
scene.glplot.canvas.addEventListener('wheel', function(e) {
245251
if(gd._context._scrollZoom.gl3d) {
246252
if(scene.camera._ortho) {
@@ -448,7 +454,9 @@ proto.render = function() {
448454
pointData.bbox = bbox[0];
449455
}
450456

451-
if(selection.buttons && selection.distance < 5) {
457+
if(selection.buttons && selection.distance < 5 && !tabletmode) {
458+
gd.emit('plotly_click', eventData);
459+
}else if(tabletmode && selection.distance < 5) {
452460
gd.emit('plotly_click', eventData);
453461
} else {
454462
gd.emit('plotly_hover', eventData);

0 commit comments

Comments
 (0)