File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export default class MapboxDirections {
5656 this . onDragMove = this . _onDragMove . bind ( this ) ;
5757 this . onDragUp = this . _onDragUp . bind ( this ) ;
5858 this . move = this . _move . bind ( this ) ;
59- this . onClick = this . _onClick . bind ( this ) ;
59+ this . onClick = this . _clickHandler ( ) . bind ( this ) ;
6060 }
6161
6262 onAdd ( map ) {
@@ -231,7 +231,27 @@ export default class MapboxDirections {
231231 } ) ;
232232 }
233233
234- _onClick ( e ) {
234+ _clickHandler ( ) {
235+ var timer = null ;
236+ var delay = 250 ;
237+ return function ( event ) {
238+ if ( ! timer ) {
239+ var singleClickHandler = this . _onSingleClick . bind ( this ) ;
240+
241+ timer = setTimeout ( function ( ) {
242+ singleClickHandler ( event ) ;
243+ timer = null ;
244+ } , delay ) ;
245+
246+ } else {
247+ clearTimeout ( timer ) ;
248+ timer = null ;
249+ this . _map . zoomIn ( ) ;
250+ }
251+ } ;
252+ }
253+
254+ _onSingleClick ( e ) {
235255 const { origin } = store . getState ( ) ;
236256 const coords = [ e . lngLat . lng , e . lngLat . lat ] ;
237257
You can’t perform that action at this time.
0 commit comments