[Solved][2.14.0] Custom markers slightly misplaced
-
Hey there, thank you for this awesome plugin.
I ran into an issue :
When specifying custom (png) markers, they are not displayed at their correct place. They seem to have a small offset. Zooming out would increase the inaccuracy. When looking closer, I figured out the markers seem to have a wrong origin, as the offset value seem to be related to the size of the custom marker icon.For those interested, I used this workaround which works for me because all my markers are the same size.
1/ Embed the leaflet.js on your own site so you have control over it
2/ unminify it
3/ in the database (with phpmyadmin for example),change in the Options table (typically wp_options), the option_name wich value is “leaflet_js_url”, in order to reflect your own URL to leaflet.js
4/ edit your local copy of leaflet.js, locate the fonction and alter it :function rt(t, i, e) {
var n = i || new x(0, 0);
var myx = n.x + 13;// <— YOUR ICON WIDTH /2
var myy = n.y + 37;// <— YOUR ICON HEIGHT
t.style[ce] = (Ri ? “translate(” + myx + “px,” + myy + “px)” : “translate3d(” + myx + “px,” + myy + “px,0)”) + (e ? ” scale(” + e + “)” : “”)
}Note this won’t support future updates of the plugin, this is a quick and dirty workaround , I didn’t have time to investigate further
- The topic ‘[Solved][2.14.0] Custom markers slightly misplaced’ is closed to new replies.