Sha256: 87e40cc158d134bab53ceb386df6d70315d94f5683c04660fe1453b375e77f17

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 Bytes

Contents

/*
 * L.DivIcon is a lightweight HTML-based icon class (as opposed to the image-based L.Icon)
 * to use with L.Marker.
 */

L.DivIcon = L.Icon.extend({
	options: {
		iconSize: [12, 12], // also can be set through CSS
		/*
		iconAnchor: (Point)
		popupAnchor: (Point)
		html: (String)
		bgPos: (Point)
		*/
		className: 'leaflet-div-icon',
		html: false
	},

	createIcon: function (oldIcon) {
		var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
		    options = this.options;

		if (options.html !== false) {
			div.innerHTML = options.html;
		} else {
			div.innerHTML = '';
		}

		if (options.bgPos) {
			div.style.backgroundPosition =
			        (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px';
		}

		this._setIconStyles(div, 'icon');
		return div;
	},

	createShadow: function () {
		return null;
	}
});

L.divIcon = function (options) {
	return new L.DivIcon(options);
};

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
leaflet-js-0.7.9 vendor/assets/Leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.8 vendor/assets/Leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.7 vendor/assets/Leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.0.4 lib/leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.0.3 lib/leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.0.2 lib/leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.0.1 lib/leaflet/src/layer/marker/DivIcon.js
leaflet-js-0.7.0 lib/leaflet/src/layer/marker/DivIcon.js