Raruto / leaflet-rotate

Leaflet plugin that allows to add rotation functionality to map tiles
GNU General Public License v3.0
81 stars 24 forks source link

Question: is there a way to rotate around an arbitrairy point? (not the center) #36

Closed BasieP closed 11 months ago

BasieP commented 1 year ago

Hi there,

Great plugin, works as promised and i'm a happy user.

But we are building some sort of navigation app, and we want to rotate the map around a point in the bottom center of the map. This way you see a lot of the map ahead of you and not so much of the roads that have passed. (which in our case is usefull)

Am I missing an option? should I use some trickery? or is it simply not possible?

Raruto commented 1 year ago

is there a way to rotate around an arbitrairy point? (not the center)

I'm not 100% sure but (out of the box) I don't think so .

In any case, there are already many utility functions within the L.Map class that you can also use as a starting point to achieve that goal.

For example:

https://github.com/Raruto/leaflet-rotate/blob/e082bf38b1fbb5be6cf0ec07af9e57552e70aa67/src/map/Map.js#L192-L215

👋 Raruto

BasieP commented 1 year ago

thanks, I'll have to dive into that. The lingo of leaflet is new to me. Lots of inheritance but hard to figure out where there the actual code is 🤣