Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/6563_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix condition of `plotly_click` to fire it on touch devices [[#6563](https://github.com/plotly/plotly.js/pull/6563)]
8 changes: 7 additions & 1 deletion src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var computeTickMarks = require('./layout/tick_marks');

var STATIC_CANVAS, STATIC_CONTEXT;

var tabletmode = false;

function Scene(options, fullLayout) {
// create sub container for plot
var sceneContainer = document.createElement('div');
Expand Down Expand Up @@ -241,6 +243,10 @@ proto.initializeGLPlot = function() {
relayoutCallback(scene);
});

scene.glplot.canvas.addEventListener('touchstart', function() {
tabletmode = true;
});

scene.glplot.canvas.addEventListener('wheel', function(e) {
if(gd._context._scrollZoom.gl3d) {
if(scene.camera._ortho) {
Expand Down Expand Up @@ -448,7 +454,7 @@ proto.render = function() {
pointData.bbox = bbox[0];
}

if(selection.buttons && selection.distance < 5) {
if(selection.distance < 5 && (selection.buttons || tabletmode)) {
gd.emit('plotly_click', eventData);
} else {
gd.emit('plotly_hover', eventData);
Expand Down