File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 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');
2424
2525var STATIC_CANVAS , STATIC_CONTEXT ;
2626
27+ var tabletmode = false ;
28+
2729function 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,7 @@ proto.render = function() {
448454 pointData . bbox = bbox [ 0 ] ;
449455 }
450456
451- if ( selection . buttons && selection . distance < 5 ) {
457+ if ( selection . distance < 5 && ( selection . buttons || tabletmode ) ) {
452458 gd . emit ( 'plotly_click' , eventData ) ;
453459 } else {
454460 gd . emit ( 'plotly_hover' , eventData ) ;
You can’t perform that action at this time.
0 commit comments