jacobtoye / leaflet.iconlabel Goto Github PK
View Code? Open in Web Editor NEWPlugin for Leaflet to add labels to map markers
License: Other
Plugin for Leaflet to add labels to map markers
License: Other
At the moment, the icon and label are bound to the same events. Is there a way to disable that so clicking a label won't fire the event?
Hi,
looking through this repo, I couldn't find a license. Would be nice to make it clear what license actually applies, since I'm about to bundle a slightly modified version - something I would not be allowed to do under the default copyright laws, if I understand correctly.
Some use cases call for the need to hide and show the label on mouse over/mouse out.
Hi,
awesome work! In my project I need a dynamic changing of numbers in a marker. With this patch I can set the digit inside. But how I can change it?
I tried this:
markers[i].icon.labelText='23';
But it doesn't work ;-(
The issue is that the iconAnchor option is used to specify the position of the label relative to the wrapper. L.Icon uses this to offset the icon.
See pull #3 for a fix for centered icons.
Does not support adding multiple labels
I have implemented Leaflet.iconlabel in my site and it works fine with Chrome and Firefox but IE (specifically version 8 as that is all I have for testing) throws "invalid argument" errors on lines:
40 and 41 (this.options.wrapperAnchor.x)
79 and 80 (this.options.wrapperAnchor.x)
89 and 90 (this.options.labelAnchor.x)
99 and 100 (this.options.iconAnchor.x)
The reference to options values above is the invalid argument that I think IE was complaining about. Doing a console.log on lines 79&80 showed this.options.wrapperAnchor.x was undefined.
I resolved this by wrapping each of the line pairs in an if statement such as:
if (this.options.wrapperAnchor.x) {
//original lines here
}
This seems to have fixed things. I'm not really sure why :-P I would have thought the values had to be defined.
Is this enough or should I create a fork? (I'm new to Github, not really sure what the process is)
When adding more than one marker, the markers appear more and more vertically offset from the actual marker coordinate. This affects only the marker image, the shadow still appears in the correct location.
I have made Gist that illustrates the example, that adds ten markers to the exact same location: https://gist.github.com/3665685
This is an illustration of how this renders in my browser:
Haven't used Leaflet.iconlabel before, so I might have made some stupid mistake, but I can't see anything wrong with the code.
The label text can be updated by adding this function:
changeLabel: function (newLabel) {
this._label.innerHTML = newLabel;
},
And changing any references to label to this._label.
This is useful for using the label to show the coordinates of a marker as you drag the marker around.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.