55 setDevicePixelRatio ,
66 isString ,
77 isArray ,
8+ detectmob ,
89 isFunction
910} from '../../common/Util' ;
1011import {
@@ -14,6 +15,7 @@ import {
1415import Toolbar from '../../map/Toolbar' ;
1516import ToolTip from '../../map/ToolTip' ;
1617let zIndex = 0 ;
18+ const isMobile = detectmob ( ) ;
1719
1820export default class CanvasOverlay extends BaseClass {
1921 constructor ( opts ) {
@@ -58,7 +60,12 @@ export default class CanvasOverlay extends BaseClass {
5860 map . addEventListener ( 'zoomstart' , this . _tOnZoomstart ) ;
5961 map . addEventListener ( 'zoomend' , this . _tOnZoomend ) ;
6062 map . addEventListener ( 'mousemove' , this . _tMousemove ) ;
61- map . addEventListener ( 'click' , this . _tMouseClick ) ;
63+ if ( isMobile ) {
64+ map . addEventListener ( 'touchstart' , this . _tMouseClick ) ;
65+ } else {
66+ map . addEventListener ( 'click' , this . _tMouseClick ) ;
67+ }
68+
6269 if ( ! map . _inmapToolBar ) {
6370 map . _inmapToolBar = new Toolbar ( map . getContainer ( ) ) ;
6471 }
@@ -215,7 +222,11 @@ export default class CanvasOverlay extends BaseClass {
215222 this . _map . removeEventListener ( 'zoomend' , this . _tOnZoomend ) ;
216223 this . _map . removeEventListener ( 'moving' , this . _tOnMoving ) ;
217224 this . _map . removeEventListener ( 'mousemove' , this . _tMousemove ) ;
218- this . _map . removeEventListener ( 'click' , this . _tMouseClick ) ;
225+ if ( isMobile ) {
226+ this . _map . removeEventListener ( 'touchstart' , this . _tMouseClick ) ;
227+ } else {
228+ this . _map . removeEventListener ( 'click' , this . _tMouseClick ) ;
229+ }
219230 }
220231
221232
0 commit comments