nypl-spacetime / Leaflet.GeotagPhoto

Leaflet plugin for photo geotagging
http://spacetime.nypl.org/Leaflet.GeotagPhoto/examples/camera.html
MIT License
70 stars 22 forks source link

Center camera within bounding box #7

Closed mmmenno closed 7 years ago

mmmenno commented 7 years ago

When the initial coordinates prove to be wrong, you move to another part of the globe and zoom in on exactly the right spot, only to find you forgot to take your camera along.

Instead of zooming out again to drag both camera and target in steps to the mentioned spot, wouldn't it be nice to simply have a button that would relocate the camera (and target) to the center of your map?

mmmenno commented 7 years ago

I know i could do so myself with setCameraAndTargetLatLng(), but maybe this might be useful for everybody?

bertspaan commented 7 years ago

The Move Camera Back button does this (or press C key) (but this button does not scale the camera, only moves it):

image

The function that does this is exposed as centerBounds. I could add function fitBounds which not just moves camera to center of map, but also fit the camera to the map's bounding box. @mmmenno what do you think?

mmmenno commented 7 years ago

Ah, right, sorry. Totally mistook the buttons for a swap between camera- and crosshairmode!

Don't know if Fitbounds is needed, i haven't been working with real data yet. Maybe we should leave it for now - i guess it all becomes less clear when the map starts moving. And besides, when you first press Move Camera Back button, and then Move Camera Back to Map button, you will obtain the same result.

bertspaan commented 7 years ago

Maybe the buttons need different icons then, do you have suggestions?

mmmenno commented 7 years ago

I'll try to come up with something - no luck so far.