File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change
1
+ - fix ` plotly_click ` in gl3d scenes to fire on touch devices [[ #6563 ] ( https://github.com/plotly/plotly.js/pull/6563 )] ,
2
+ with thanks to @NickTominaga for the contribution!
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ var computeTickMarks = require('./layout/tick_marks');
24
24
25
25
var STATIC_CANVAS , STATIC_CONTEXT ;
26
26
27
+ var tabletmode = false ;
28
+
27
29
function Scene ( options , fullLayout ) {
28
30
// create sub container for plot
29
31
var sceneContainer = document . createElement ( 'div' ) ;
@@ -241,6 +243,10 @@ proto.initializeGLPlot = function() {
241
243
relayoutCallback ( scene ) ;
242
244
} ) ;
243
245
246
+ scene . glplot . canvas . addEventListener ( 'touchstart' , function ( ) {
247
+ tabletmode = true ;
248
+ } ) ;
249
+
244
250
scene . glplot . canvas . addEventListener ( 'wheel' , function ( e ) {
245
251
if ( gd . _context . _scrollZoom . gl3d ) {
246
252
if ( scene . camera . _ortho ) {
@@ -448,7 +454,7 @@ proto.render = function() {
448
454
pointData . bbox = bbox [ 0 ] ;
449
455
}
450
456
451
- if ( selection . buttons && selection . distance < 5 ) {
457
+ if ( selection . distance < 5 && ( selection . buttons || tabletmode ) ) {
452
458
gd . emit ( 'plotly_click' , eventData ) ;
453
459
} else {
454
460
gd . emit ( 'plotly_hover' , eventData ) ;
You can’t perform that action at this time.
0 commit comments