I reproduced this issue with the following demo: http://jsfiddle.net/baoqger/deL0yuvg/9/
In my project, I have a custom icon marker which I want to rotate the icon on some cases.
I add a claasname when the icon is created:
const uturnIcon = L.icon({
iconUrl: 'http://joshuafrazier.info/images/firefox.svg',
iconSize: [30, 30],
className: 'u-turn-icon'
})
and add css style for the class as following:
.u-turn-icon {
transform: rotate(20deg) !important
}
The problem is by default, the icon img has a style attribute of transform: translate3d
, so there is conflict between the default transform and my added transform style. And the default transform style is created by leaflet itself, when we zoom the map, the value for this attribute is updated as well.
So how to solve this issue?