/*! * leaflet-extra-markers * Custom Markers for Leaflet JS based on Awesome Markers * Leaflet ExtraMarkers * https://github.com/coryasilva/Leaflet.ExtraMarkers/ * @author coryasilva * @version 1.0.9 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.leaflet = global.leaflet || {}, global.leaflet['extra-markers'] = {}))); }(this, (function (exports) { 'use strict'; var ExtraMarkers = L.ExtraMarkers = {}; ExtraMarkers.version = L.ExtraMarkers.version = "1.0.8"; ExtraMarkers.Icon = L.ExtraMarkers.Icon = L.Icon.extend({ options: { iconSize: [ 35, 45 ], iconAnchor: [ 17, 42 ], popupAnchor: [ 1, -32 ], shadowAnchor: [ 10, 12 ], shadowSize: [ 36, 16 ], className: "", prefix: "", extraClasses: "", shape: "", icon: "", innerHTML: "", markerColor: "red", svgBorderColor: "#fff", svgOpacity: 1, iconColor: "#fff", number: "", svg: false }, initialize: function(options) { options = L.Util.setOptions(this, options); }, createIcon: function() { var div = document.createElement("div"), options = this.options; if (options.icon) { div.innerHTML = this._createInner(); } if (options.innerHTML) { div.innerHTML = options.innerHTML; } if (options.bgPos) { div.style.backgroundPosition = -options.bgPos.x + "px " + -options.bgPos.y + "px"; } if (!options.svg) { this._setIconStyles(div, options.shape + "-" + options.markerColor); } else { this._setIconStyles(div, "svg"); } return div; }, _createInner: function() { var iconColorStyle = "", iconNumber = "", options = this.options; if (options.iconColor) { iconColorStyle = "style='color: " + options.iconColor + "' "; } if (options.number) { iconNumber = "number='" + options.number + "' "; } if (options.svg) { var svg = ''; if (options.shape === "square") { svg = ''; } if (options.shape === "star") { svg = ''; } if (options.shape === "penta") { svg = ''; } return svg + ""; } return ""; }, _setIconStyles: function(img, name) { var options = this.options, size = L.point(options[name === "shadow" ? "shadowSize" : "iconSize"]), anchor, leafletName; if (name === "shadow") { anchor = L.point(options.shadowAnchor || options.iconAnchor); leafletName = "shadow"; } else { anchor = L.point(options.iconAnchor); leafletName = "icon"; } if (!anchor && size) { anchor = size.divideBy(2, true); } // img.className = "leaflet-marker-" + leafletName + " extra-marker extra-marker-" + name + " " + options.className; img.className = "leaflet-marker-" + leafletName + " extra-marker extra-marker-" + name + " " + options.className; if (anchor) { img.style.marginLeft = -anchor.x + "px"; img.style.marginTop = -anchor.y + "px"; } if (size) { img.style.width = size.x + "px"; img.style.height = size.y + "px"; } }, createShadow: function() { var div = document.createElement("div"); this._setIconStyles(div, "shadow"); return div; } }); ExtraMarkers.icon = L.ExtraMarkers.icon = function(options) { return new L.ExtraMarkers.Icon(options); }; exports.ExtraMarkers = ExtraMarkers; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=leaflet.extra-markers.js.map