Different colors and map zoom
Hello! I'd like to have different colors for different lines. For example coloring a passage by boat red and a passage by bus yellow.
And additionally, it would be nice to determine where the map zoom as default. For example, I have a round the world trip going, but the whole plan of the trip is on the map, so it's zoomed way out. It would be better to have it zoomed to for example current location +-2 locations.
6 comments
-
Ben
commented
Just to expand on Liam's solution for default zoom, I enhanced this to also center on the last location. Make his edits as suggested, and then make these additional ones:
Add to the very top of the file:
var lastLoc;Find the text "locations['past'].push(location);" and add this line after it (both times, it appears twice):
lastLoc = location;Find the text "this.setZoom(" and add this line after it:
this.setCenter(lastLoc);That's it! The map should now center on your last location.
-
Liam
commented
Just wanted to share I got the zoom figured out.
In wordpress, I went to the Edit Plugins section and looked for the travelmap plugin. I clicked on Edit and then clicked on the travelmap.js file on the right section of the dashboard.
Near the bottom of the file I added the piece of Javascript to zoom in on the end. This is what I added (the first two lines below you will see is there already). Hope it works for you. I picked the number 2 because that is the level of zoom I wanted. Increase it if you want to zoom more.
// Set center and zoom depending on marker position
travelmap_map.fitBounds(markerBounds);zoomChangeBoundsListener =
google.maps.event.addListenerOnce(travelmap_map, 'bounds_changed', function(event) {
if (this.getZoom()){
this.setZoom(2);
}
});
setTimeout(function(){google.maps.event.removeListener(zoomChangeBoundsListener)}, 2000); -
Liam
commented
Has anyone tried to write a javascript that would grab the map canvas on load and when it is initialized to zoom in using the Google Maps API?
Something that would do an action along these lines..
https://developers.google.com/maps/documentation/javascript/events
-
guido
commented
another idea would be to centre the last location by default.
-
Kasia
commented
I think different colors for different lines are a great idea! Transport really matters ones you want to show your travel. Especially flying that is not really a very demanding part of a journey.
If you could do it with a possibility to chose those colors or changed them with the colors that
match ones page that would be just absolutely fabulous!
Thank you very much for the plugin. Its the best one I found!
Kasia -
HappyToBeHomeless
commented
I agree about the zooming. I love the simplicity of your plugin! It's worked great for me, but now that I've traveled over an extensive area, it's zoomed way out. I would like for it to stay zoomed around my current location if possible. Again, thanks for such a great plugin!