File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -560,6 +560,7 @@ MIT License
560560 var self = this ;
561561 var o = self . _options ;
562562 if ( options ) {
563+ var trackingChanged = false ;
563564 if ( options . style ) {
564565 var color = 'white' ;
565566 if ( self . _hclStyle ) {
@@ -615,9 +616,6 @@ MIT License
615616 self . _onGpsSuccess ( ) ;
616617 }
617618 }
618- if ( typeof options . trackUserLocation === 'boolean' ) {
619- o . trackUserLocation = options . trackUserLocation ;
620- }
621619 if ( options . positionOptions ) {
622620 var opt = { } ;
623621 if ( options . positionOptions . enableHighAccuracy ) {
@@ -631,8 +629,7 @@ MIT License
631629 }
632630 if ( Object . keys ( opt ) . length > 0 ) {
633631 o . positionOptions = Object . assign ( o . positionOptions , opt ) ;
634- self . _stopTracking ( ) ;
635- self . _updateState ( ) ;
632+ trackingChanged = true ;
636633 }
637634 }
638635 if ( typeof options . enableCompass === 'boolean' ) {
@@ -653,6 +650,14 @@ MIT License
653650 if ( typeof options . compassEventThrottleDelay === 'number' && options . compassEventThrottleDelay >= 100 ) {
654651 o . compassEventThrottleDelay = options . compassEventThrottleDelay ;
655652 }
653+ if ( typeof options . trackUserLocation === 'boolean' ) {
654+ o . trackUserLocation = options . trackUserLocation ;
655+ trackingChanged = true ;
656+ }
657+ if ( o . trackUserLocation && trackingChanged ) {
658+ self . _stopTracking ( ) ;
659+ self . _updateState ( ) ;
660+ }
656661 }
657662 } ;
658663 /**
You can’t perform that action at this time.
0 commit comments