diff --git a/src/images/marker-clean.svg b/src/images/marker-clean.svg new file mode 100644 index 000000000..d9baea378 --- /dev/null +++ b/src/images/marker-clean.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/images/shadow-clean.svg b/src/images/shadow-clean.svg new file mode 100644 index 000000000..1e92b64cd --- /dev/null +++ b/src/images/shadow-clean.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/layer/marker/Icon.Default.js b/src/layer/marker/Icon.Default.js index fc6996c51..322efb3b3 100644 --- a/src/layer/marker/Icon.Default.js +++ b/src/layer/marker/Icon.Default.js @@ -1,6 +1,13 @@ import {Icon} from './Icon'; import * as DomUtil from '../../dom/DomUtil'; +// The contents of src/image/marker-clean.svg, minus spaces, replacing '#' with '%23'. +var svgIcon = ''; + +// The contents of src/image/shadow-clean.svg, minus spaces, replacing '#' with '%23'. +var svgShadow = '' + + /* * @miniclass Icon.Default (Icon) * @aka L.Icon.Default @@ -18,43 +25,13 @@ import * as DomUtil from '../../dom/DomUtil'; */ export var IconDefault = Icon.extend({ - options: { - iconUrl: 'marker-icon.png', - iconRetinaUrl: 'marker-icon-2x.png', - shadowUrl: 'marker-shadow.png', + iconUrl: 'data:image/svg+xml,' + svgIcon, + shadowUrl: 'data:image/svg+xml,' + svgShadow, iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], tooltipAnchor: [16, -28], shadowSize: [41, 41] - }, - - _getIconUrl: function (name) { - if (!IconDefault.imagePath) { // Deprecated, backwards-compatibility only - IconDefault.imagePath = this._detectIconPath(); - } - - // @option imagePath: String - // `Icon.Default` will try to auto-detect the location of the - // blue icon images. If you are placing these images in a non-standard - // way, set this option to point to the right path. - return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name); - }, - - _detectIconPath: function () { - var el = DomUtil.create('div', 'leaflet-default-icon-path', document.body); - var path = DomUtil.getStyle(el, 'background-image') || - DomUtil.getStyle(el, 'backgroundImage'); // IE8 - - document.body.removeChild(el); - - if (path === null || path.indexOf('url') !== 0) { - path = ''; - } else { - path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, ''); - } - - return path; } });