I have several markers in a group and I want to zoom in, so they're all visible.
With version 3.0 of mapsjs I could do this:
var cameraData = map.getCameraDataForBounds(group.getBounds());
map.setZoom(cameraData.zoom - 0.5, true);
map.setCenter(cameraData.position, true);
With version 3.1 getCameraDataForBounds
was removed and the documentation tells me to do it this way:
map.getViewModel().setLookAtData({
bounds: group.getBoundingBox()
}, true);
My problem is, that with the new way, the markers are very close to the edge. With the 3.0 way, I could add some margin by simply adjusting the zoom level. That doesn't seem possible with 3.1 since I can't seem to find a replacement for getCameraDataForBounds
.
Zooming in and then back out, seems hacky and kills my animation. I tried widening the bounding box, but couldn't find a reliable way to do it.
Any advice on how to archive this would be greatly appreciated.