New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offsets on image marker added #328
Conversation
So this has not been merged yet? Last commit 9 months ago. :/ |
Hi @pootzko. Do you own a Commercial or Developer license? |
Hi, I am currently in the development phase of a feature (this and the next week) so we do not own it at this very moment. But yes, we decided to go with jvectormap and we will get the Commercial license just before deployment to production the next week or the week after that one. |
@pootzko, do you need the "image markers offset" feature for your project? |
Yes, because replacing the default marker with an image makes it move a bit towards bottom right. Would it be possible for you to merge this in perhaps? |
It will be done by the end of this week |
Most awesome, thank you. |
I reviewed this pull request once again: it is badly designed, does not follow the principle of separation of concern and solves only one use-case - add offsets to all markers in series. Because of these reasons I can not merge it as is. @pootzko can you please clarify on your problem and why do you need marker offset? What does it mean "makes it move a bit towards bottom right"? From the demos I have image markers are perfectly centered as well as regular circular markers. What browser do you use to reproduce this problem? Can I have some screenshots? |
I did it quickly, maybe it's not the best place to do it. |
Hi, sorry, I am not at work today and tomorrow so unfortunately I can't get you any screenshots until Monday. Imagine if the coordinates for the default circle were at say 10,10. The circle is in the right place, everything is fine. Then say instead of the default circles you use a png icon that has a size of 16x16 pixels. It seems that the icons upper left corner is perhaps placed at the 10,10 - and where the icon actually points to is a bit to the right and down. For example a circle is pointing to London, but the png icons point (like the one @william57m linked) is pointing somewhere at the sea between England and France. I hope that makes sense. I can prepare some screenshots for you on Monday if you think that would help clarify the issue. |
Pushed a better solution for this to develop 95b405f. You can apply offset to marker images when you use them as scale value or just a style attribute. |
Hi, could you please explain a bit more what you meant by "just a style attribute"? A style as in This is a simpler version of markers array that I have: // something like this, a bit more complex with a few more properties, but that's it
var markers = [{
name: "something 1",
latLng: [10, 10],
phone: "something 1",
email: "something 1"
}, {
name: "something 2",
latLng: [15, 15],
phone: "something 2",
email: "something 2"
}] And this would be my vectorMap setup: function initializeMap() {
$("#world-map").vectorMap({
map: "world_mill",
backgroundColor: "white",
regionStyle: {
initial: {
fill: "#ECECEC"
},
hover: {
fill: "#D1D1D1"
}
},
zoomButtons : false,
zoomOnScroll: false,
markers: markers,
markerStyle: {
initial: {
image: "/images/marker-pin.png"
// to me it would make sense for the offset prop to be here for example
}
},
onMarkerTipShow: function(event, label, index){
// do something
}
});
} Now, I looked at markers.html and I am not sure how to use the scale in my case or if it's even possible (I tried a few different combinations that did not work). You used it with The other approach - The lib was also not bundled so I had to run the Thank you. P.S. - We just go the license 15-ish minutes ago. |
You can do it like this: markerStyle: { } On Mon, May 9, 2016 at 6:58 PM, Tihomir Kit notifications@github.com
Best regards, |
Works nicely, thanks. |
My commit allows to give an offset for image marker.
I think it's something useful, because when you use image for marker, it is centered on the GPS coordinate and it's not always what we want, for example if you use a pin image you would like to point the arrow on the coordinate and it's wasn't possible without offset.