Last active
August 29, 2015 14:21
-
-
Save chriswhong/bb1e72b87bc640b8739c to your computer and use it in GitHub Desktop.
Leaflet initial view helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Logs current map center and zoom level for use in map init options | |
| //Use it to find that perfect intial view without having to use trial and error | |
| map.on('dragend',getInit).on('zoomend',getInit); | |
| function getInit() { | |
| var c = map.getCenter(); | |
| console.log('center: [' + c.lat + ',' + c.lng + '],\nzoom: ' + map.getZoom()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment