nachtwezen
nachtwezen

Reputation: 123

Is it possible, in mapbox-gl-js, to have the map's center not be the canvas' center?

I'm trying to create a map where the geographical center point (which all the animations/actions... use) is not the canvas' center point. What I want is to be able to use API like setCenter(latlong) or setBearing(rot) as you would with a normal canvas center, just that the map's center is rendered somewhere not on the canvas' center.

For example, the map could rotate around a center point which would be located on the canvas like this:

enter image description here

I know you can provide a 'center' parameter to animations. However, if you adjust e.g. bearing with setBearing, then it does not seem possible to let the map rotate around something else than the canvas' center? Stuff like e.g. pitch center etc. would also be affected.

Upvotes: 1

Views: 627

Answers (1)

Lucas Wojciechowski
Lucas Wojciechowski

Reputation: 3782

This is a feature that we have not yet implemented in GL JS. You can track the feature request at https://github.com/mapbox/mapbox-gl-js/issues/1740

Upvotes: 1

Related Questions