| | |
| | | const init = (L) => { |
| | | (function(window) { |
| | | console.log(window) |
| | | let setOptions = function(obj, options) { |
| | | for (let i in options) { |
| | | obj[i] = options[i] |
| | | } |
| | | return obj |
| | | } |
| | | L.Icon.Magic = function(options) { |
| | | let opts |
| | | if (options.iconUrl) { |
| | | opts = { |
| | | html: "<div class='magicDiv'><div class='magictime " + options.magic + "'><img id='migic' src='" + options.iconUrl + "'/></div></div>" |
| | | // className: 'magicDiv', |
| | | } |
| | | } else { |
| | | opts = { |
| | | html: "<div class='magicDiv'><div class='magictime " + options.magic + "'>" + options.html + '</div></div>' |
| | | // className: 'magicDiv', |
| | | } |
| | | } |
| | | delete options.html |
| | | let magicIconOpts = setOptions(opts, options) |
| | | // console.log(magicIconOpts) |
| | | let magicIcon = L.divIcon(magicIconOpts) |
| | | return magicIcon |
| | | } |
| | | /* eslint-disable */ |
| | | (function (window) { |
| | | console.log(window) |
| | | const setOptions = function (obj, options) { |
| | | for (const i in options) { |
| | | obj[i] = options[i] |
| | | } |
| | | return obj |
| | | } |
| | | L.Icon.Magic = function (options) { |
| | | let opts |
| | | // console.log(options) |
| | | if (options.iconUrl) { |
| | | opts = { |
| | | html: '<div class=\'magicDiv\'><div class=\'magictime ' + options.magic + '\'>' + options.html + '</div></div>' |
| | | // className: 'magicDiv',L |
| | | } |
| | | } else { |
| | | opts = { |
| | | html: '<div class=\'magicDiv\'><div class=\'magictime ' + options.magic + '\'><img id=\'migic\' src=\'' + options.icon.options.iconUrl + '\'/></div></div>' |
| | | // className: 'magicDiv', |
| | | } |
| | | } |
| | | delete options.html |
| | | const magicIconOpts = setOptions(opts, options) |
| | | // console.log(magicIconOpts) |
| | | const magicIcon = L.divIcon(magicIconOpts) |
| | | return magicIcon |
| | | } |
| | | |
| | | L.icon.magic = function(options) { |
| | | return new L.Icon.Magic(options) |
| | | } |
| | | L.icon.magic = function (options) { |
| | | return new L.Icon.Magic(options) |
| | | } |
| | | |
| | | L.Marker.Magic = L.Marker.extend({ |
| | | initialize: function(latlng, options) { |
| | | options.icon = L.icon.magic(options) |
| | | L.Marker.prototype.initialize.call(this, latlng, options) |
| | | } |
| | | }) |
| | | L.Marker.Magic = L.Marker.extend({ |
| | | initialize: function (latlng, options) { |
| | | options.icon = L.icon.magic(options) |
| | | L.Marker.prototype.initialize.call(this, latlng, options) |
| | | } |
| | | }) |
| | | |
| | | L.marker.magic = function(latlng, options) { |
| | | return new L.Marker.Magic(latlng, options) |
| | | } |
| | | })(window) |
| | | } |
| | | |
| | | export default { |
| | | init |
| | | } |
| | | L.marker.magic = function (latlng, options) { |
| | | return new L.Marker.Magic(latlng, options) |
| | | } |
| | | })(window) |