Raruto / leaflet-rotate

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

Change Pivot for rotation #37

Closed pirex360 closed 1 year ago

pirex360 commented 1 year ago

I'm trying to build a similar screen to car navigation using leaflet, I have already done the tilting, the carMarker... but now to be 100% complete I need to rotate not from the center pivot, but be able to specify the pivot to be my car Marker that is in the bottom, centre screen like a GPS navigation system.

Does anyone happen to achieve this? or similar?

Raruto commented 1 year ago

Does anyone happen to achieve this? or similar?

isn't it a duplicate of https://github.com/Raruto/leaflet-rotate/issues/36#issuecomment-1632611681 ?

pirex360 commented 1 year ago

Yes, sorry... For now, I resolve the problem by increasing the canvas, hiding overflow and putting only the centre, top with a little offset on Y. I am just testing performance issues because now the map is 2 times bigger.

Raruto commented 1 year ago

Yes, sorry... For now, I resolve the problem by increasing the canvas, hiding overflow and putting only the centre, top with a little offset on Y.

👌

I am just testing performance issues because now the map is 2 times bigger.

If someone bothers to delve also into the leaflet's source code a bit it shouldn't be anything too hard (but it also depends a bit on the type of animation that someones want to get..)

Here is a ready-made "similar" example, without rewriting without re-write the above function: https://github.com/Raruto/leaflet-rotate/issues/36#issuecomment-1632611681:

https://github.com/Raruto/leaflet-rotate/blob/e082bf38b1fbb5be6cf0ec07af9e57552e70aa67/examples/leaflet-rotate.spec.js#L67-L72

👋 Raruto