You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using both packages, it means that the standard leaflet Marker will be replaced by an extension (A) that applies rotation. (by leaflet-rotatedmarker)
And this new extension (A) will be once again extended (B, by leaflet-polylinedecorator) to apply the same rotation.
Now the Marker "class" of leaflet points to B.
And as we can see in the code, the _setPos function always call the "super" function before applying the rotation.
The call chain will be: B -> A -> original Marker
But B and A both applies the rotation, causing the bug.
Another issue is that leaflet-rotatedmarker is also a depedency for this package which makes it so in most settings, you cannot avoid this bug even if you want to rotate markers with PolylineDecorator alone.
Workaround(s)
The simplest fix is to divide the rotation angle by 2 and comment why you did so
Create your own rotated marker extension, that do not replace the real Marker
Manually change the code to handle such cases, but then it creates code that is very hard to maintain
The text was updated successfully, but these errors were encountered:
Explanation
The rotation is applied twice if you're using
leaflet-polylinedecorator
andleaflet-rotatedmarker
.In the marker HTML that is then generated by Leaflet, we can see the following:
The
rotateZ()
is present 2 times.This is because the package is already reusing the same
Marker.include(...)
asleaflet-rotatedmarker
:Leaflet.PolylineDecorator/dist/leaflet.polylineDecorator.js
Lines 127 to 183 in 96858e8
As you can see in the above code, it's the same code as: https://github.com/bbecquet/Leaflet.RotatedMarker/blob/master/leaflet.rotatedMarker.js
If you are using both packages, it means that the standard leaflet Marker will be replaced by an extension (A) that applies rotation. (by leaflet-rotatedmarker)
And this new extension (A) will be once again extended (B, by leaflet-polylinedecorator) to apply the same rotation.
Now the
Marker
"class" of leaflet points to B.And as we can see in the code, the
_setPos
function always call the "super" function before applying the rotation.The call chain will be: B -> A -> original Marker
But B and A both applies the rotation, causing the bug.
Another issue is that
leaflet-rotatedmarker
is also a depedency for this package which makes it so in most settings, you cannot avoid this bug even if you want to rotate markers with PolylineDecorator alone.Workaround(s)
Marker
The text was updated successfully, but these errors were encountered: