Created
August 3, 2013 00:20
-
-
Save typpo/6144460 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Support for putting text on a marker | |
| * @author akearney | |
| */ | |
| L.TextIcon = L.Icon.extend({ | |
| options: { | |
| iconUrl: undefined, | |
| text: undefined, | |
| }, | |
| createIcon: function() { | |
| var me = this; | |
| me.div = document.createElement('div'); | |
| var text = document.createElement('div'); | |
| me.$text = $(text); | |
| me.img = me._createImg(me.options.iconUrl); | |
| me.$text.html(me.options.text); | |
| me.$text.addClass('marker_text'); | |
| me.div.appendChild(me.img); | |
| me.div.appendChild(text); | |
| me._setIconStyles(me.div, 'icon'); | |
| return me.div; | |
| }, | |
| changeText: function(newText) { | |
| var me = this; | |
| me.$text.html(newText); | |
| me.options.text = newText; | |
| }, | |
| changeImage: function(newUrl) { | |
| var me = this; | |
| me.img = me._createImg(newUrl); | |
| me.options.iconUrl = newUrl; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment