none
How do I keep the Bing V8 map from automatically centering on the calculated route? RRS feed

  • Question

  • I'm writing some tools for some dispatching software, and I need the map to be as still as possible unless acted upon by the user, however, when I calculate a route, the map zooms to focus on said route.  Here is a sample of the code below:

    function jobClick(sender) { var dId = GetOrderID(sender); $.each(currentLoc, function (index, result) { if (result.OrderID == dId) { cLoc = new Microsoft.Maps.Location(result.location.lat, result.location.lon, { address: result.location.address }); dLoc = new Microsoft.Maps.Location(result.location.dlat, result.location.dlon, { address: result.DriverID }); } }); tempPin = new Microsoft.Maps.Pushpin(cLoc, { text: t.attr('id') }); map.entities.push(tempPin); Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () { var dm= new Microsoft.Maps.Directions.DirectionsManager(map); dm.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving }); //I've tried here to set autoupdate to false, but I don't really see any difference, or know if that's the right thing to to.

    dm.setRenderOptions({ autoUpdateMapView: false }); var w1= new Microsoft.Maps.Directions.Waypoint({ location: dLoc }); var w2= new Microsoft.Maps.Directions.Waypoint({ location: cLoc }); dm.addWaypoint(w1); dm.addWaypoint(w2); dm.calculateDirections(); }); };


    Any thoughts on this?



    • Edited by RogueLancer Friday, September 9, 2016 3:15 PM Fixed line break.
    Friday, September 9, 2016 3:14 PM

Answers

All replies