diff --git a/dist/leaflet-vector-markers.css b/dist/leaflet-vector-markers.css index 8c1b857..e4a395c 100644 --- a/dist/leaflet-vector-markers.css +++ b/dist/leaflet-vector-markers.css @@ -26,12 +26,10 @@ Version: 0.0.6 height: 40%; position: absolute; right: 21px; - -webkit-transform-origin: 50% 50%; - -ms-transform-origin: 50% 50%; - transform-origin: 50% 50%; - -webkit-transform: skew(150deg) rotate(-40deg); - -ms-transform: skew(150deg) rotate(-40deg); - transform: skew(150deg) rotate(-40deg); + -ms-transform-origin: 50% 50%; + transform-origin: 50% 50%; + -ms-transform: skew(150deg) rotate(-40deg); + transform: skew(150deg) rotate(-40deg); width: 60%; z-index: -1; } diff --git a/dist/leaflet-vector-markers.js b/dist/leaflet-vector-markers.js index 9026e44..5af1218 100644 --- a/dist/leaflet-vector-markers.js +++ b/dist/leaflet-vector-markers.js @@ -52,7 +52,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -81,15 +81,15 @@ return /******/ (function(modules) { // webpackBootstrap _leaflet2.default.VectorMarkers = _VectorMarkers3.default; -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_1__; -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -113,9 +113,9 @@ return /******/ (function(modules) { // webpackBootstrap } }; -/***/ }, +/***/ }), /* 3 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -162,7 +162,7 @@ return /******/ (function(modules) { // webpackBootstrap function Icon(options) { _classCallCheck(this, Icon); - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Icon).call(this, options)); + var _this = _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).call(this, options)); _leaflet2.default.Util.setOptions(_this, iconOptions); _leaflet2.default.Util.setOptions(_this, options); @@ -200,14 +200,14 @@ return /******/ (function(modules) { // webpackBootstrap var i = document.createElement('i'); var options = this.options; - i.classList.add(options.prefix); - if (options.extraClasses) { + if (options.extraClasses && typeof options.extraClasses === 'string') { i.classList.add(options.extraClasses); } - if (options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-') { - i.classList.add(options.icon); - } else { + if (options.prefix && typeof options.prefix === 'string') { i.classList.add(options.prefix + '-' + options.icon); + i.classList.add(options.prefix); + } else { + i.classList.add(options.icon); } if (options.spin && typeof options.spinClass === 'string') { i.classList.add(options.spinClass); @@ -256,7 +256,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.default = Icon; -/***/ } +/***/ }) /******/ ]) }); -; \ No newline at end of file +; diff --git a/dist/leaflet-vector-markers.min.js b/dist/leaflet-vector-markers.min.js index c76e82f..7904f2e 100644 --- a/dist/leaflet-vector-markers.min.js +++ b/dist/leaflet-vector-markers.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("leaflet")):"function"==typeof define&&define.amd?define(["leaflet"],t):"object"==typeof exports?exports.VectorMarkers=t(require("leaflet")):e.VectorMarkers=t(e.L)}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Icon=t.VectorMarkers=void 0;var r=o(2),i=n(r),s=o(3),a=n(s),c=o(1),l=n(c);t.VectorMarkers=a["default"],t.Icon=l["default"],i["default"].VectorMarkers=a["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;o',o.icon&&t.appendChild(this._createInner()),o.className+=o.className.length>0?" "+o.extraDivClasses:o.extraDivClasses,this._setIconStyles(t,"icon"),this._setIconStyles(t,"icon-"+o.markerColor),t}},{key:"createShadow",value:function(){var e=document.createElement("div");return this._setIconStyles(e,"shadow"),e}},{key:"_createInner",value:function(){var e=document.createElement("i"),t=this.options;return e.classList.add(t.prefix),t.extraClasses&&e.classList.add(t.extraClasses),t.icon.slice(0,t.prefix.length+1)===t.prefix+"-"?e.classList.add(t.icon):e.classList.add(t.prefix+"-"+t.icon),t.spin&&"string"==typeof t.spinClass&&e.classList.add(t.spinClass),t.iconColor&&("white"===t.iconColor||"black"===t.iconColor?e.classList.add("icon-"+t.iconColor):e.style.color=t.iconColor),t.iconSize&&(e.style.width=t.iconSize[0]+"px"),e}},{key:"_setIconStyles",value:function(e,t){var o=this.options,n=l["default"].point(o["shadow"===t?"shadowSize":"iconSize"]),r=void 0;r="shadow"===t?l["default"].point(o.shadowAnchor||o.iconAnchor):l["default"].point(o.iconAnchor),!r&&n&&(r=n.divideBy(2,!0)),e.className="vector-marker-"+t+" "+o.className,r&&(e.style.marginLeft=-r.x+"px",e.style.marginTop=-r.y+"px"),n&&(e.style.width=n.x+"px",e.style.height=n.y+"px")}}]),t}(l["default"].Icon);t["default"]=p},function(t,o){t.exports=e},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),i=n(r);t["default"]={version:"1.0.0",Icon:i["default"],icon:function(e){return new i["default"](e)}}}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("leaflet")):"function"==typeof define&&define.amd?define(["leaflet"],t):"object"==typeof exports?exports.VectorMarkers=t(require("leaflet")):e.VectorMarkers=t(e.L)}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Icon=t.VectorMarkers=void 0;var r=o(2),i=n(r),s=o(3),a=n(s),c=o(1),l=n(c);t.VectorMarkers=a.default,t.Icon=l.default,i.default.VectorMarkers=a.default},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;o',o.icon&&t.appendChild(this._createInner()),o.className+=o.className.length>0?" "+o.extraDivClasses:o.extraDivClasses,this._setIconStyles(t,"icon"),this._setIconStyles(t,"icon-"+o.markerColor),t}},{key:"createShadow",value:function(){var e=document.createElement("div");return this._setIconStyles(e,"shadow"),e}},{key:"_createInner",value:function(){var e=document.createElement("i"),t=this.options;return t.extraClasses&&"string"==typeof t.extraClasses&&e.classList.add(t.extraClasses),t.prefix&&"string"==typeof t.prefix?(e.classList.add(t.prefix+"-"+t.icon),e.classList.add(t.prefix)):e.classList.add(t.icon),t.spin&&"string"==typeof t.spinClass&&e.classList.add(t.spinClass),t.iconColor&&("white"===t.iconColor||"black"===t.iconColor?e.classList.add("icon-"+t.iconColor):e.style.color=t.iconColor),t.iconSize&&(e.style.width=t.iconSize[0]+"px"),e}},{key:"_setIconStyles",value:function(e,t){var o=this.options,n=l.default.point(o["shadow"===t?"shadowSize":"iconSize"]),r=void 0;r="shadow"===t?l.default.point(o.shadowAnchor||o.iconAnchor):l.default.point(o.iconAnchor),!r&&n&&(r=n.divideBy(2,!0)),e.className="vector-marker-"+t+" "+o.className,r&&(e.style.marginLeft=-r.x+"px",e.style.marginTop=-r.y+"px"),n&&(e.style.width=n.x+"px",e.style.height=n.y+"px")}}]),t}(l.default.Icon);t.default=p},function(t,o){t.exports=e},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),i=n(r);t.default={version:"1.0.0",Icon:i.default,icon:function(e){return new i.default(e)}}}])}); \ No newline at end of file diff --git a/lib/Icon.js b/lib/Icon.js index bee7160..cca335d 100644 --- a/lib/Icon.js +++ b/lib/Icon.js @@ -43,7 +43,7 @@ var Icon = function (_Leaflet$Icon) { function Icon(options) { _classCallCheck(this, Icon); - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Icon).call(this, options)); + var _this = _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).call(this, options)); _leaflet2.default.Util.setOptions(_this, iconOptions); _leaflet2.default.Util.setOptions(_this, options); @@ -81,14 +81,14 @@ var Icon = function (_Leaflet$Icon) { var i = document.createElement('i'); var options = this.options; - i.classList.add(options.prefix); - if (options.extraClasses) { + if (options.extraClasses && typeof options.extraClasses === 'string') { i.classList.add(options.extraClasses); } - if (options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-') { - i.classList.add(options.icon); - } else { + if (options.prefix && typeof options.prefix === 'string') { i.classList.add(options.prefix + '-' + options.icon); + i.classList.add(options.prefix); + } else { + i.classList.add(options.icon); } if (options.spin && typeof options.spinClass === 'string') { i.classList.add(options.spinClass); diff --git a/package.json b/package.json index 2bf51aa..b857fed 100644 --- a/package.json +++ b/package.json @@ -25,14 +25,12 @@ "lintAndTest": "npm run lint && jest" }, "dependencies": { - "autoprefixer": "^6.3.7", - "leaflet": "^0.7.0", - "postcss-loader": "^0.9.1" }, "peerDependencies": { - "leaflet": "^0.7.0" + "leaflet": "^1.0.0" }, "devDependencies": { + "autoprefixer": "^6.3.7", "babel-cli": "^6.9.0", "babel-core": "^6.9.1", "babel-eslint": "^6.0.4", @@ -46,6 +44,7 @@ "jest-cli": "^12.1.1", "node-sass": "^3.7.0", "onchange": "^2.4.0", + "postcss-loader": "^0.9.1", "sass-loader": "^3.2.0", "style-loader": "^0.13.1", "webpack": "^1.13.1", diff --git a/src/Icon.js b/src/Icon.js index f03dd02..00bb1b5 100644 --- a/src/Icon.js +++ b/src/Icon.js @@ -53,12 +53,12 @@ export default class Icon extends Leaflet.Icon { const i = document.createElement('i') const options = this.options - i.classList.add(options.prefix) - if (options.extraClasses) { + if (options.extraClasses && typeof options.extraClasses === 'string') { i.classList.add(options.extraClasses) } - if (options.prefix) { + if (options.prefix && typeof options.prefix === 'string') { i.classList.add(options.prefix + '-' + options.icon) + i.classList.add(options.prefix) } else { i.classList.add(options.icon) }