-
Notifications
You must be signed in to change notification settings - Fork 2
/
LeafpileIcon.js
39 lines (34 loc) · 1.24 KB
/
LeafpileIcon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* ==========================================================
* L.LeafpileIcon
*
* Icon for use with a Leafpile
* ========================================================== */
L.LeafpileIcon = L.DivIcon.extend({
// special constructor to include group count, index (in
// the sizes array), and size def object
initialize: function (count, index, def) {
this.lpCount = count;
this.lpIndex = index;
this.lpDef = def;
L.Util.setOptions(this, {
className: 'leafpile-icon leafpile-size-' + index,
html: '<b>' + count + '</b>',
iconSize: def.size,
iconAnchor: def.anchor,
popupAnchor: def.popup
});
},
// set special inline styles
_setIconStyles: function (div, name) {
L.Icon.prototype._setIconStyles.call(this, div, 'icon');
div.style.cursor = 'pointer';
div.style.background = 'url(data:image/png;base64,' + this.lpDef.image + ') no-repeat 0 0';
div.style.textAlign = 'center';
div.style.fontSize = '13px';
div.style.color = '#fff';
div.style.lineHeight = this.options.iconSize.y + 'px';
}
});
L.leafpileIcon = function (options) {
return new L.LeafpileIcon();
};