thebillcarr

Toggle Geolocation map.centerAndZoom

Discussion created by thebillcarr on May 13, 2014
Greetings,

I have set up the geolocation from the Esri tutorial and it works great( with enableHighAccuracy that is), but I need the ability to toggle off and on the center and zoom so that the point is still placed, but the map can be panned without centering back on the user graphic (WatchID).

 function showLocation(location) {
         
          //zoom to the users location and add a graphic
          var pt = new Point(location.coords.longitude, location.coords.latitude);
          if ( !graphic ) {
            
          } else { // move the graphic if it already exists
            graphic.setGeometry(pt);
            
          
            
          }
 
          
         console.log(" Fire on 3!");
          
          addGraphic(pt);
          


          
          
          
        }



Has anybody accomplished this? I've tried a dozen examples for toggling but no luck. Any help is massively appreciated as I only have a small amount of hair left to pull out.

Outcomes