Leaflet.AnimatedMarker icon indicating copy to clipboard operation
Leaflet.AnimatedMarker copied to clipboard

feature request: flip marker image, depending on direction of movement

Open willemx opened this issue 10 years ago • 4 comments

First: thank you for this nice plugin!

I am using it to display a walking route using a "walking person" icon. When the route is headed east-west, the person icon is walking in its natural forward direction. When the route is west-east however, the icon is walking backwards. I should like to "flip" the icon when changing direction. Another option would be to rotate the icon depending on the compass angle of each route segment. (BTW: I would prefer the flip option, because rotating would make my walking person icon move upside-down when heading westwards...)

willemx avatar Mar 17 '14 13:03 willemx

@willemx Did you find any solution to your problem?

codeswithroh avatar Jun 02 '22 19:06 codeswithroh

yes, i put something together using https://github.com/bbecquet/Leaflet.RotatedMarker and https://gitlab.com/IvanSanchez/Leaflet.Marker.SlideTo

willemx avatar Jun 03 '22 13:06 willemx

But how are you getting the angle to rotate?

codeswithroh avatar Jun 06 '22 04:06 codeswithroh

angle = L.GeometryUtil.bearing(startLatLng, nextLatLng) using this lib: https://github.com/makinacorpus/Leaflet.GeometryUtil

willemx avatar Jun 08 '22 14:06 willemx