Permalink
Browse files

Merge pull request #21 from axeff/routing-zoom-to

added zoom functionality for route extension
  • Loading branch information...
2 parents 5353ec2 + 873915f commit 92d5b94199e7093121863b176b9ce973c9892873 @mmarcon committed Feb 28, 2014
Showing with 7 additions and 1 deletion.
  1. +1 −0 EXTENSIONS.md
  2. +6 −1 src/extensions/route.js
View
@@ -51,6 +51,7 @@ or an array
trafficMode: 'default', //can be enabled, disabled, default
width: 4, //width in px of the route drawn on the map
color: '#ff6347', //color of the route drawn on the map
+ zoomTo: false, //will disable zooming to bounds of calculated route
onroute: function(route){} //optional callbacks that gets the list of maneuvers with some
//basic info, plus total time (seconds) and length (meters)
}
View
@@ -31,7 +31,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
marker: {
text: '#',
textColor: '#fff'
- }
+ },
+ zoomTo: true
};
function normalize(position){
@@ -100,6 +101,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
this.marker(w.originalPosition, o);
}, this));
this.map.objects.add(routeContainer);
+ /*Zoom map to bounds of route*/
+ if(options.zoomTo){
+ this.map.zoomTo(routeContainer.getBoundingBox(), false, "default");
+ }
/*Now let's look into the route infos*/
leg = r.legs && r.legs.length && r.legs[0];
info.time = leg.travelTime;

0 comments on commit 92d5b94

Please sign in to comment.