From 2192146709a1b5c07006dfb1f52384bfbf93b0ae Mon Sep 17 00:00:00 2001 From: Joel Kravets Date: Tue, 28 Nov 2017 22:31:02 -0700 Subject: [PATCH] Released a new version. --- bower.json | 2 +- dist/snazzy-info-window.js | 154 ++++++++++++++++------------- dist/snazzy-info-window.min.js | 2 +- dist/snazzy-info-window.min.js.map | 2 +- package.json | 2 +- 5 files changed, 89 insertions(+), 73 deletions(-) diff --git a/bower.json b/bower.json index befcb83..87ca963 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "snazzy-info-window", "description": "Customizable info windows using the Google Maps JavaScript API.", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/atmist/snazzy-info-window", "repository": { "url": "https://github.com/atmist/snazzy-info-window.git", diff --git a/dist/snazzy-info-window.js b/dist/snazzy-info-window.js index 1942a03..16a7ec8 100644 --- a/dist/snazzy-info-window.js +++ b/dist/snazzy-info-window.js @@ -181,7 +181,7 @@ // Convert the value into a Google Map LatLng function toLatLng(v) { - if (v !== undefined && v !== null && google) { + if (v !== undefined && v !== null) { if (v instanceof google.maps.LatLng) { return v; } else if (v.lat !== undefined && v.lng !== undefined) { @@ -191,14 +191,23 @@ return null; } - var SnazzyInfoWindow = function (_google$maps$OverlayV) { - _inherits(SnazzyInfoWindow, _google$maps$OverlayV); + // Export SnazzyInfoWindow even if google is not yet defined. + var getGoogleClass = function getGoogleClass() { + return typeof google !== 'undefined' ? google.maps.OverlayView : function noop() {}; + }; + + var SnazzyInfoWindow = function (_getGoogleClass) { + _inherits(SnazzyInfoWindow, _getGoogleClass); function SnazzyInfoWindow(opts) { _classCallCheck(this, SnazzyInfoWindow); var _this = _possibleConstructorReturn(this, (SnazzyInfoWindow.__proto__ || Object.getPrototypeOf(SnazzyInfoWindow)).call(this, opts)); + if (typeof google === 'undefined') { + console.warn('Snazzy Info Window: Google Maps is not defined!'); //eslint-disable-line + return _possibleConstructorReturn(_this); + } // Private properties _this._html = null; _this._opts = mergeDefaultOptions(opts); @@ -210,7 +219,7 @@ _this._listeners = []; // This listener remains active when the info window is closed. - if (google && _this._marker && _this._opts.openOnMarkerClick) { + if (_this._marker && _this._opts.openOnMarkerClick) { _this.trackListener(google.maps.event.addListener(_this._marker, 'click', function () { if (!_this.getMap()) { _this.open(); @@ -274,18 +283,16 @@ }, { key: 'clearListeners', value: function clearListeners(clearPersistent) { - if (google) { - if (this._listeners) { - this._listeners.forEach(function (e) { - if (clearPersistent || !e.persistent) { - google.maps.event.removeListener(e.listener); - e.listener = null; - } - }); - this._listeners = this._listeners.filter(function (e) { - return e.listener != null; - }); - } + if (this._listeners) { + this._listeners.forEach(function (e) { + if (clearPersistent || !e.persistent) { + google.maps.event.removeListener(e.listener); + e.listener = null; + } + }); + this._listeners = this._listeners.filter(function (e) { + return e.listener != null; + }); } } }, { @@ -343,6 +350,21 @@ this.reposition(); } } + }, { + key: 'setWrapperClass', + value: function setWrapperClass(wrapperClass) { + if (this._html && this._html.wrapper) { + var w = this._html.wrapper; + w.className = _classPrefix + 'wrapper-' + this._opts.placement; + if (this._opts.border) { + w.className += ' ' + _classPrefix + 'has-border'; + } + if (wrapperClass) { + w.className += ' ' + wrapperClass; + } + } + this._opts.wrapperClass = wrapperClass; + } }, { key: 'getWrapper', value: function getWrapper() { @@ -471,7 +493,9 @@ // Correctly rotate the shadows before the css transform var hRotated = _inverseRoot2 * (hOffset.value - vOffset.value) + hOffset.units; var vRotated = _inverseRoot2 * (hOffset.value + vOffset.value) + vOffset.units; - this._html.shadowPointerInner.style.boxShadow = formatBoxShadow(hRotated, vRotated); + if (this._html.shadowPointerInner) { + this._html.shadowPointerInner.style.boxShadow = formatBoxShadow(hRotated, vRotated); + } } if (this._opts.shadow.opacity) { this._html.shadowWrapper.style.opacity = this._opts.shadow.opacity; @@ -488,9 +512,7 @@ this.resize(); this.reposition(); this.activateCallback('afterOpen'); - if (google) { - google.maps.event.trigger(this.getMap(), _eventPrefix + 'opened', this); - } + google.maps.event.trigger(this.getMap(), _eventPrefix + 'opened', this); } } }, { @@ -528,13 +550,8 @@ this._html = {}; // 1. Create the wrapper - this._html.wrapper = newElement('wrapper-' + this._opts.placement); - if (this._opts.wrapperClass) { - this._html.wrapper.className += ' ' + this._opts.wrapperClass; - } - if (this._opts.border) { - applyCss(this._html.wrapper, ['has-border']); - } + this._html.wrapper = newElement(); + this.setWrapperClass(this._opts.wrapperClass); // 2. Create the shadow if (this._opts.shadow) { @@ -608,53 +625,52 @@ } })); } - if (google) { - // Clear out the previous map bounds - this._previousWidth = null; - this._previousHeight = null; - this.trackListener(google.maps.event.addListener(map, 'bounds_changed', function () { - var d = map.getDiv(); - var ow = d.offsetWidth; - var oh = d.offsetHeight; - var pw = _this2._previousWidth; - var ph = _this2._previousHeight; - if (pw === null || ph === null || pw !== ow || ph !== oh) { - _this2._previousWidth = ow; - _this2._previousHeight = oh; - _this2.resize(); - } - })); - // Marker moves - if (this._marker) { - this.trackListener(google.maps.event.addListener(this._marker, 'position_changed', function () { - _this2.draw(); - })); + // Clear out the previous map bounds + this._previousWidth = null; + this._previousHeight = null; + this.trackListener(google.maps.event.addListener(map, 'bounds_changed', function () { + var d = map.getDiv(); + var ow = d.offsetWidth; + var oh = d.offsetHeight; + var pw = _this2._previousWidth; + var ph = _this2._previousHeight; + if (pw === null || ph === null || pw !== ow || ph !== oh) { + _this2._previousWidth = ow; + _this2._previousHeight = oh; + _this2.resize(); } + })); - // Close button - if (this._opts.showCloseButton && !this._opts.closeButtonMarkup) { - this.trackListener(google.maps.event.addDomListener(this._html.closeButton, 'click', function (e) { - e.cancelBubble = true; - if (e.stopPropagation) { - e.stopPropagation(); - } - _this2.close(); - })); - } + // Marker moves + if (this._marker) { + this.trackListener(google.maps.event.addListener(this._marker, 'position_changed', function () { + _this2.draw(); + })); + } - // Stop the mouse event propagation - var mouseEvents = ['click', 'dblclick', 'rightclick', 'contextmenu', 'drag', 'dragend', 'dragstart', 'mousedown', 'mouseout', 'mouseover', 'mouseup', 'touchstart', 'touchend', 'touchmove', 'wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; - mouseEvents.forEach(function (event) { - _this2.trackListener(google.maps.event.addDomListener(_this2._html.wrapper, event, function (e) { - e.cancelBubble = true; - if (e.stopPropagation) { - e.stopPropagation(); - } - })); - }); + // Close button + if (this._opts.showCloseButton && !this._opts.closeButtonMarkup) { + this.trackListener(google.maps.event.addDomListener(this._html.closeButton, 'click', function (e) { + e.cancelBubble = true; + if (e.stopPropagation) { + e.stopPropagation(); + } + _this2.close(); + })); } + // Stop the mouse event propagation + var mouseEvents = ['click', 'dblclick', 'rightclick', 'contextmenu', 'drag', 'dragend', 'dragstart', 'mousedown', 'mouseout', 'mouseover', 'mouseup', 'touchstart', 'touchend', 'touchmove', 'wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; + mouseEvents.forEach(function (event) { + _this2.trackListener(google.maps.event.addDomListener(_this2._html.wrapper, event, function (e) { + e.cancelBubble = true; + if (e.stopPropagation) { + e.stopPropagation(); + } + })); + }); + this.activateCallback('open'); } }, { @@ -735,7 +751,7 @@ }]); return SnazzyInfoWindow; - }(google.maps.OverlayView); + }(getGoogleClass()); exports.default = SnazzyInfoWindow; module.exports = exports['default']; diff --git a/dist/snazzy-info-window.min.js b/dist/snazzy-info-window.min.js index 8060faf..609ac8d 100644 --- a/dist/snazzy-info-window.min.js +++ b/dist/snazzy-info-window.min.js @@ -1,2 +1,2 @@ -!function(t,e){if("function"==typeof define&&define.amd)define("SnazzyInfoWindow",["module","exports"],e);else if("undefined"!=typeof exports)e(module,exports);else{var o={exports:{}};e(o,o.exports),t.SnazzyInfoWindow=o.exports}}(this,function(t,e){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function r(t,e){t&&e&&Object.keys(e).forEach(function(o){t[o]=e[o]})}function n(t){var e={};return r(e,f),r(e,t),Object.keys(f).forEach(function(t){var o=f[t];if("object"===(void 0===o?"undefined":d(o))){var i={};r(i,o),r(i,e[t]),e[t]=i}}),e}function h(t,e){var o=/^(-{0,1}\.{0,1}\d+(\.\d+)?)[\s|\.]*(\w*)$/;if(t&&o.test(t)){var i=o.exec(t);return{value:1*i[1],units:i[3]||"px",original:t}}return e?h(e):{original:e}}function p(t,e){if(t){for(;t.firstChild;)t.removeChild(t.firstChild);e&&("string"==typeof e?t.innerHTML=e:t.appendChild(e))}}function a(t){return"top"===t?"bottom":"bottom"===t?"top":"left"===t?"right":"right"===t?"left":t}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){if(void 0!==t&&null!==t&&google){if(t instanceof google.maps.LatLng)return t;if(void 0!==t.lat&&void 0!==t.lng)return new google.maps.LatLng(t)}return null}Object.defineProperty(e,"__esModule",{value:!0});var _=function(){function t(t,e){for(var o=0;o=e.left?o=e.left-t.left:t.right<=e.right&&(o=e.left-(t.right-e.width)),t.top>=e.top?i=e.top-t.top:t.bottom<=e.bottom&&(i=e.top-(t.bottom-e.height)),0===o&&0===i||this.getMap().panBy(o,i)}}},{key:"resize",value:function(){if(this._html){var t=this.getMapInnerBounds(),e=t.width;void 0!==this._opts.maxWidth&&(e=Math.min(e,this._opts.maxWidth)),e-=this._html.wrapper.offsetWidth-this._html.content.offsetWidth,this._html.content.style.maxWidth=e+"px";var o=t.height;void 0!==this._opts.maxHeight&&(o=Math.min(o,this._opts.maxHeight)),o-=this._html.wrapper.offsetHeight-this._html.content.offsetHeight,this._html.content.style.maxHeight=o+"px"}}}]),e}(google.maps.OverlayView);e.default=m,t.exports=e.default}); +!function(t,e){if("function"==typeof define&&define.amd)define("SnazzyInfoWindow",["module","exports"],e);else if("undefined"!=typeof exports)e(module,exports);else{var o={exports:{}};e(o,o.exports),t.SnazzyInfoWindow=o.exports}}(this,function(t,e){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function n(t,e){t&&e&&Object.keys(e).forEach(function(o){t[o]=e[o]})}function r(t){var e={};return n(e,f),n(e,t),Object.keys(f).forEach(function(t){var o=f[t];if("object"===(void 0===o?"undefined":d(o))){var i={};n(i,o),n(i,e[t]),e[t]=i}}),e}function h(t,e){var o=/^(-{0,1}\.{0,1}\d+(\.\d+)?)[\s|\.]*(\w*)$/;if(t&&o.test(t)){var i=o.exec(t);return{value:1*i[1],units:i[3]||"px",original:t}}return e?h(e):{original:e}}function p(t,e){if(t){for(;t.firstChild;)t.removeChild(t.firstChild);e&&("string"==typeof e?t.innerHTML=e:t.appendChild(e))}}function a(t){return"top"===t?"bottom":"bottom"===t?"top":"left"===t?"right":"right"===t?"left":t}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){if(void 0!==t&&null!==t){if(t instanceof google.maps.LatLng)return t;if(void 0!==t.lat&&void 0!==t.lng)return new google.maps.LatLng(t)}return null}Object.defineProperty(e,"__esModule",{value:!0});var _=function(){function t(t,e){for(var o=0;o=e.left?o=e.left-t.left:t.right<=e.right&&(o=e.left-(t.right-e.width)),t.top>=e.top?i=e.top-t.top:t.bottom<=e.bottom&&(i=e.top-(t.bottom-e.height)),0===o&&0===i||this.getMap().panBy(o,i)}}},{key:"resize",value:function(){if(this._html){var t=this.getMapInnerBounds(),e=t.width;void 0!==this._opts.maxWidth&&(e=Math.min(e,this._opts.maxWidth)),e-=this._html.wrapper.offsetWidth-this._html.content.offsetWidth,this._html.content.style.maxWidth=e+"px";var o=t.height;void 0!==this._opts.maxHeight&&(o=Math.min(o,this._opts.maxHeight)),o-=this._html.wrapper.offsetHeight-this._html.content.offsetHeight,this._html.content.style.maxHeight=o+"px"}}}]),e}(function(){return"undefined"!=typeof google?google.maps.OverlayView:function(){}}());e.default=m,t.exports=e.default}); //# sourceMappingURL=snazzy-info-window.min.js.map diff --git a/dist/snazzy-info-window.min.js.map b/dist/snazzy-info-window.min.js.map index fdb2e04..8595ea7 100644 --- a/dist/snazzy-info-window.min.js.map +++ b/dist/snazzy-info-window.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["snazzy-info-window.js"],"names":["copyKeys","target","source","Object","keys","forEach","key","mergeDefaultOptions","opts","copy","_defaultOptions","obj","_typeof","objCopy","parseAttribute","attribute","defaultValue","re","test","match","exec","value","units","original","setHTML","container","content","firstChild","removeChild","innerHTML","appendChild","oppositePlacement","p","capitalizePlacement","charAt","toUpperCase","slice","toLatLng","v","undefined","google","maps","LatLng","lat","lng","_defaultShadow","h","blur","spread","color","placement","pointer","openOnMarkerClick","closeOnMapClick","closeWhenOthersOpen","showCloseButton","panOnOpen","edgeOffset","top","right","bottom","left","SnazzyInfoWindow","_classCallCheck","this","_this","_possibleConstructorReturn","__proto__","getPrototypeOf","call","_html","_opts","_callbacks","callbacks","_marker","marker","_map","map","_position","position","_isOpen","_listeners","trackListener","event","addListener","getMap","open","offset","String","toLowerCase","border","shadow","callback","lambda","apply","listener","persistent","push","clearPersistent","e","removeListener","filter","result","activateCallback","setMap","clearListeners","latLng","draw","resize","reposition","wrapper","style","marginLeft","marginTop","bg","backgroundColor","contentWrapper","pointerBg","padding","shadowFrame","borderRadius","fontSize","fontColor","shadowPointer","width","height","pointerBorder","borderWidth","bWidth","Math","round","offsetWidth","clientWidth","pLength","min","offsetHeight","triangleDiff","reverseP","borderColor","isSet","hOffset","vOffset","formatBoxShadow","boxShadow","hRotated","vRotated","shadowPointerInner","opacity","shadowWrapper","divPixel","getProjection","fromLatLngToDivPixel","floatWrapper","floor","y","x","trigger","_eventPrefix","_this2","applyCss","element","args","i","length","className","newElement","_len","arguments","Array","_key","document","createElement","wrapperClass","closeButtonMarkup","d","closeButton","setAttribute","getPanes","floatPane","close","other","_previousWidth","_previousHeight","getDiv","ow","oh","pw","ph","addDomListener","cancelBubble","stopPropagation","parent","parentElement","mb","getBoundingClientRect","mib","getMapInnerBounds","wb","dx","dy","panBy","maxWidth","maxHeight","OverlayView"],"mappings":"k0BA6BA,QAASA,GAASC,EAAQC,GAClBD,GAAUC,GACVC,OAAOC,KAAKF,GAAQG,QAAQ,SAACC,GACzBL,EAAOK,GAAOJ,EAAOI,KAOjC,QAASC,GAAoBC,GACzB,GAAMC,KAYN,OAXAT,GAASS,EAAMC,GACfV,EAASS,EAAMD,GACfL,OAAOC,KAAKM,GAAiBL,QAAQ,SAACC,GAClC,GAAMK,GAAMD,EAAgBJ,EAC5B,IAAmB,YAAf,SAAOK,EAAP,YAAAC,EAAOD,IAAkB,CACzB,GAAME,KACNb,GAASa,EAASF,GAClBX,EAASa,EAASJ,EAAKH,IACvBG,EAAKH,GAAOO,KAGbJ,EAIX,QAASK,GAAeC,EAAWC,GAE/B,GAAMC,GAAK,2CACX,IAAIF,GAAaE,EAAGC,KAAKH,GAAY,CACjC,GAAMI,GAAQF,EAAGG,KAAKL,EAGtB,QAASM,MAAgB,EAFVF,EAAM,GAEOG,MADdH,EAAM,IAAM,KACSI,SAAUR,GAEjD,MAAIC,GACOF,EAAeE,IAEjBO,SAAUP,GAKvB,QAASQ,GAAQC,EAAWC,GACxB,GAAID,EAAW,CAEX,KAAOA,EAAUE,YACbF,EAAUG,YAAYH,EAAUE,WAEhCD,KACuB,gBAAZA,GACPD,EAAUI,UAAYH,EAEtBD,EAAUK,YAAYJ,KAOtC,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nconst _inverseRoot2 = 0.7071067811865474;\r\nconst _eventPrefix = 'snazzy-info-window-';\r\nconst _defaultShadow = {\r\n h: '0px',\r\n v: '3px',\r\n blur: '6px',\r\n spread: '0px',\r\n color: '#000'\r\n};\r\nconst _defaultOptions = {\r\n placement: 'top',\r\n pointer: true,\r\n openOnMarkerClick: true,\r\n closeOnMapClick: true,\r\n closeWhenOthersOpen: false,\r\n showCloseButton: true,\r\n panOnOpen: true,\r\n edgeOffset: {\r\n top: 20,\r\n right: 20,\r\n bottom: 20,\r\n left: 20\r\n }\r\n};\r\n\r\n// Copy keys from the source into the target\r\nfunction copyKeys(target, source) {\r\n if (target && source) {\r\n Object.keys(source).forEach((key) => {\r\n target[key] = source[key];\r\n });\r\n }\r\n}\r\n\r\n// We need to safely merge options from the defaults. This will make\r\n// sure settings like edgeOffset are properly assigned.\r\nfunction mergeDefaultOptions(opts) {\r\n const copy = {};\r\n copyKeys(copy, _defaultOptions);\r\n copyKeys(copy, opts);\r\n Object.keys(_defaultOptions).forEach((key) => {\r\n const obj = _defaultOptions[key];\r\n if (typeof obj === 'object') {\r\n const objCopy = {};\r\n copyKeys(objCopy, obj);\r\n copyKeys(objCopy, copy[key]);\r\n copy[key] = objCopy;\r\n }\r\n });\r\n return copy;\r\n}\r\n\r\n// Parse a css attribute into the numeric portion and the units\r\nfunction parseAttribute(attribute, defaultValue) {\r\n // 1em, 1.0em, 0.1em, .1em, 1. em\r\n const re = /^(-{0,1}\\.{0,1}\\d+(\\.\\d+)?)[\\s|\\.]*(\\w*)$/;\r\n if (attribute && re.test(attribute)) {\r\n const match = re.exec(attribute);\r\n const number = match[1];\r\n const units = match[3] || 'px';\r\n return { value: number * 1, units, original: attribute };\r\n }\r\n if (defaultValue) {\r\n return parseAttribute(defaultValue);\r\n }\r\n return { original: defaultValue };\r\n}\r\n\r\n// Set the html of a container. Should support both raw text and a single\r\n// DOM Element.\r\nfunction setHTML(container, content) {\r\n if (container) {\r\n // Clear out everything in the container\r\n while (container.firstChild) {\r\n container.removeChild(container.firstChild);\r\n }\r\n if (content) {\r\n if (typeof content === 'string') {\r\n container.innerHTML = content;\r\n } else {\r\n container.appendChild(content);\r\n }\r\n }\r\n }\r\n}\r\n\r\n// Get the opposite of a given placement\r\nfunction oppositePlacement(p) {\r\n if (p === 'top') {\r\n return 'bottom';\r\n } else if (p === 'bottom') {\r\n return 'top';\r\n } else if (p === 'left') {\r\n return 'right';\r\n } else if (p === 'right') {\r\n return 'left';\r\n }\r\n return p;\r\n}\r\n\r\n// Return the placement with the first letter capitalized\r\nfunction capitalizePlacement(p) {\r\n return p.charAt(0).toUpperCase() + p.slice(1);\r\n}\r\n\r\n// Convert the value into a Google Map LatLng\r\nfunction toLatLng(v) {\r\n if (v !== undefined && v !== null && google) {\r\n if (v instanceof google.maps.LatLng) {\r\n return v;\r\n } else if (v.lat !== undefined && v.lng !== undefined) {\r\n return new google.maps.LatLng(v);\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport default class SnazzyInfoWindow extends google.maps.OverlayView {\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // Private properties\r\n this._html = null;\r\n this._opts = mergeDefaultOptions(opts);\r\n this._callbacks = this._opts.callbacks || {};\r\n this._marker = this._opts.marker;\r\n this._map = this._opts.map;\r\n this._position = toLatLng(this._opts.position);\r\n this._isOpen = false;\r\n this._listeners = [];\r\n\r\n // This listener remains active when the info window is closed.\r\n if (google && this._marker && this._opts.openOnMarkerClick) {\r\n this.trackListener(google.maps.event.addListener(this._marker, 'click', () => {\r\n if (!this.getMap()) {\r\n this.open();\r\n }\r\n }), true);\r\n }\r\n\r\n // When using a position the default option for the offset is 0\r\n if (this._position && !this._opts.offset) {\r\n this._opts.offset = {\r\n top: '0px',\r\n left: '0px'\r\n };\r\n }\r\n\r\n // Validate the placement option\r\n let p = opts.placement || this._opts.position;\r\n // The position variable was renamed to placement so we must type check\r\n if (typeof p === 'string' || p instanceof String) {\r\n p = p.toLowerCase();\r\n }\r\n if (p !== 'top' && p !== 'bottom' &&\r\n p !== 'left' && p !== 'right') {\r\n this._opts.placement = _defaultOptions.placement;\r\n } else {\r\n this._opts.placement = p;\r\n }\r\n\r\n // Validate the position option\r\n p = this._opts.position;\r\n if (p !== undefined && p !== null &&\r\n typeof p !== 'string' && !(p instanceof String)) {\r\n this._opts.position = p;\r\n }\r\n\r\n // Validate the other options\r\n if (this._opts.border === undefined || this._opts.border === true) {\r\n this._opts.border = {};\r\n }\r\n if (this._opts.pointer === undefined) {\r\n this._opts.pointer = _defaultOptions.pointer;\r\n }\r\n if (this._opts.shadow === undefined || this._opts.shadow === true) {\r\n this._opts.shadow = {};\r\n }\r\n }\r\n\r\n // Activate the specified callback and return the result\r\n activateCallback(callback) {\r\n const lambda = this._callbacks[callback];\r\n return lambda ? lambda.apply(this) : undefined;\r\n }\r\n\r\n // Track the provided listener. A persistent listener means it remains\r\n // tracked even if the info window is closed.\r\n trackListener(listener, persistent) {\r\n this._listeners.push({ listener, persistent });\r\n }\r\n\r\n // Will clear all listeners that are used during the open state.\r\n clearListeners(clearPersistent) {\r\n if (google) {\r\n if (this._listeners) {\r\n this._listeners.forEach((e) => {\r\n if (clearPersistent || !e.persistent) {\r\n google.maps.event.removeListener(e.listener);\r\n e.listener = null;\r\n }\r\n });\r\n this._listeners = this._listeners.filter((e) => {\r\n return e.listener != null;\r\n });\r\n }\r\n }\r\n }\r\n\r\n isOpen() {\r\n return this._isOpen;\r\n }\r\n\r\n // Open the info window after attaching to a specific marker.\r\n open() {\r\n const result = this.activateCallback('beforeOpen');\r\n if (result !== undefined && !result) {\r\n return;\r\n }\r\n if (this._marker) {\r\n this.setMap(this._marker.getMap());\r\n } else if (this._map && this._position) {\r\n this.setMap(this._map);\r\n }\r\n }\r\n\r\n // Close the info window.\r\n close() {\r\n const result = this.activateCallback('beforeClose');\r\n if (result !== undefined && !result) {\r\n return;\r\n }\r\n this.clearListeners();\r\n this.setMap(null);\r\n }\r\n\r\n // Force close the map and remove any event listeners attached to google\r\n destroy() {\r\n if (this.getMap()) {\r\n this.setMap(null);\r\n }\r\n // Make sure to clear all persistent listeners\r\n this.clearListeners(true);\r\n }\r\n\r\n setContent(content) {\r\n this._opts.content = content;\r\n if (this._html && this._html.content) {\r\n setHTML(this._html.content, content);\r\n }\r\n }\r\n\r\n setPosition(latLng) {\r\n this._position = toLatLng(latLng);\r\n if (this._isOpen && this._position) {\r\n this.draw();\r\n this.resize();\r\n this.reposition();\r\n }\r\n }\r\n\r\n getWrapper() {\r\n if (this._html) {\r\n return this._html.wrapper;\r\n }\r\n return null;\r\n }\r\n\r\n // Implementation of OverlayView draw method.\r\n draw() {\r\n if (!this.getMap() || !this._html) {\r\n return;\r\n }\r\n if (!this._marker && !this._position) {\r\n return;\r\n }\r\n\r\n // 1. Assign offset\r\n const offset = this._opts.offset;\r\n if (offset) {\r\n if (offset.left) {\r\n this._html.wrapper.style.marginLeft = offset.left;\r\n }\r\n if (offset.top) {\r\n this._html.wrapper.style.marginTop = offset.top;\r\n }\r\n }\r\n // 2. Set the background color\r\n const bg = this._opts.backgroundColor;\r\n if (bg) {\r\n this._html.contentWrapper.style.backgroundColor = bg;\r\n if (this._opts.pointer) {\r\n this._html.pointerBg.style[`border${capitalizePlacement(this._opts.placement)}Color`] = bg;\r\n }\r\n }\r\n // 3. Padding\r\n if (this._opts.padding) {\r\n this._html.contentWrapper.style.padding = this._opts.padding;\r\n if (this._opts.shadow) {\r\n this._html.shadowFrame.style.padding = this._opts.padding;\r\n }\r\n }\r\n // 4. Border radius\r\n if (this._opts.borderRadius) {\r\n this._html.contentWrapper.style.borderRadius = this._opts.borderRadius;\r\n if (this._opts.shadow) {\r\n this._html.shadowFrame.style.borderRadius = this._opts.borderRadius;\r\n }\r\n }\r\n // 5. Font Size\r\n if (this._opts.fontSize) {\r\n this._html.wrapper.style.fontSize = this._opts.fontSize;\r\n }\r\n // 6. Font Color\r\n if (this._opts.fontColor) {\r\n this._html.contentWrapper.style.color = this._opts.fontColor;\r\n }\r\n // 7. Pointer\r\n // Check if the pointer is enabled. Also make sure the value isn't just the boolean true.\r\n if (this._opts.pointer && this._opts.pointer !== true) {\r\n if (this._opts.shadow) {\r\n this._html.shadowPointer.style.width = this._opts.pointer;\r\n this._html.shadowPointer.style.height = this._opts.pointer;\r\n }\r\n if (this._html.pointerBorder) {\r\n this._html.pointerBorder.style.borderWidth = this._opts.pointer;\r\n }\r\n this._html.pointerBg.style.borderWidth = this._opts.pointer;\r\n }\r\n\r\n // 8. Border\r\n if (this._opts.border) {\r\n // Calculate the border width\r\n let bWidth = 0;\r\n if (this._opts.border.width !== undefined) {\r\n bWidth = parseAttribute(this._opts.border.width, '0px');\r\n this._html.contentWrapper.style.borderWidth = bWidth.value + bWidth.units;\r\n }\r\n bWidth = Math.round((this._html.contentWrapper.offsetWidth -\r\n this._html.contentWrapper.clientWidth) / 2.0);\r\n bWidth = parseAttribute(`${bWidth}px`, '0px');\r\n\r\n if (this._opts.pointer) {\r\n // Calculate the pointer length\r\n let pLength = Math.min(this._html.pointerBorder.offsetHeight,\r\n this._html.pointerBorder.offsetWidth);\r\n pLength = parseAttribute(`${pLength}px`, '0px');\r\n\r\n let triangleDiff = Math.round(bWidth.value * (_root2 - 1));\r\n triangleDiff = Math.min(triangleDiff, pLength.value);\r\n\r\n this._html.pointerBg.style.borderWidth =\r\n (pLength.value - triangleDiff) + pLength.units;\r\n\r\n const reverseP = capitalizePlacement(oppositePlacement(this._opts.placement));\r\n this._html.pointerBg.style[`margin${reverseP}`] =\r\n triangleDiff + bWidth.units;\r\n this._html.pointerBg.style[this._opts.placement] =\r\n -bWidth.value + bWidth.units;\r\n }\r\n const color = this._opts.border.color;\r\n if (color) {\r\n this._html.contentWrapper.style.borderColor = color;\r\n if (this._html.pointerBorder) {\r\n this._html.pointerBorder.style[`border${capitalizePlacement(this._opts.placement)}Color`] = color;\r\n }\r\n }\r\n }\r\n // 9. Shadow\r\n if (this._opts.shadow) {\r\n // Check if any of the shadow settings have actually been set\r\n const shadow = this._opts.shadow;\r\n const isSet = (attribute) => {\r\n const v = shadow[attribute];\r\n return v !== undefined && v != null;\r\n };\r\n\r\n if (isSet('h') || isSet('v') || isSet('blur') || isSet('spread') || isSet('color')) {\r\n const hOffset = parseAttribute(shadow.h, _defaultShadow.h);\r\n const vOffset = parseAttribute(shadow.v, _defaultShadow.v);\r\n const blur = parseAttribute(shadow.blur, _defaultShadow.blur);\r\n const spread = parseAttribute(shadow.spread, _defaultShadow.spread);\r\n const color = shadow.color || _defaultShadow.color;\r\n const formatBoxShadow = (h, v) => {\r\n return `${h} ${v} ${blur.original} ${spread.original} ${color}`;\r\n };\r\n\r\n this._html.shadowFrame.style.boxShadow =\r\n formatBoxShadow(hOffset.original, vOffset.original);\r\n\r\n // Correctly rotate the shadows before the css transform\r\n const hRotated = (_inverseRoot2 * (hOffset.value - vOffset.value)) + hOffset.units;\r\n const vRotated = (_inverseRoot2 * (hOffset.value + vOffset.value)) + vOffset.units;\r\n this._html.shadowPointerInner.style.boxShadow = formatBoxShadow(hRotated, vRotated);\r\n }\r\n if (this._opts.shadow.opacity) {\r\n this._html.shadowWrapper.style.opacity = this._opts.shadow.opacity;\r\n }\r\n }\r\n\r\n const divPixel = this.getProjection()\r\n .fromLatLngToDivPixel(this._position || this._marker.position);\r\n if (divPixel) {\r\n this._html.floatWrapper.style.top = `${Math.floor(divPixel.y)}px`;\r\n this._html.floatWrapper.style.left = `${Math.floor(divPixel.x)}px`;\r\n }\r\n if (!this._isOpen) {\r\n this._isOpen = true;\r\n this.resize();\r\n this.reposition();\r\n this.activateCallback('afterOpen');\r\n if (google) {\r\n google.maps.event.trigger(this.getMap(), `${_eventPrefix}opened`, this);\r\n }\r\n }\r\n }\r\n\r\n // Implementation of OverlayView onAdd method.\r\n onAdd() {\r\n if (this._html) {\r\n return;\r\n }\r\n // Used for creating new elements\r\n const applyCss = (element, args) => {\r\n if (element && args) {\r\n for (let i = 0; i < args.length; i++) {\r\n const className = args[i];\r\n if (className) {\r\n if (element.className) {\r\n element.className += ' ';\r\n }\r\n element.className += _classPrefix + className;\r\n }\r\n }\r\n }\r\n };\r\n const newElement = (...args) => {\r\n const element = document.createElement('div');\r\n applyCss(element, args);\r\n return element;\r\n };\r\n\r\n this._html = {};\r\n\r\n // 1. Create the wrapper\r\n this._html.wrapper = newElement(\r\n `wrapper-${this._opts.placement}`\r\n );\r\n if (this._opts.wrapperClass) {\r\n this._html.wrapper.className += ` ${this._opts.wrapperClass}`;\r\n }\r\n if (this._opts.border) {\r\n applyCss(this._html.wrapper, ['has-border']);\r\n }\r\n\r\n // 2. Create the shadow\r\n if (this._opts.shadow) {\r\n this._html.shadowWrapper = newElement(\r\n `shadow-wrapper-${this._opts.placement}`\r\n );\r\n this._html.shadowFrame = newElement(\r\n 'frame',\r\n 'shadow-frame'\r\n );\r\n this._html.shadowWrapper.appendChild(this._html.shadowFrame);\r\n\r\n if (this._opts.pointer) {\r\n this._html.shadowPointer = newElement(\r\n `shadow-pointer-${this._opts.placement}`\r\n );\r\n this._html.shadowPointerInner = newElement(\r\n `shadow-inner-pointer-${this._opts.placement}`\r\n );\r\n this._html.shadowPointer.appendChild(this._html.shadowPointerInner);\r\n this._html.shadowWrapper.appendChild(this._html.shadowPointer);\r\n }\r\n\r\n this._html.wrapper.appendChild(this._html.shadowWrapper);\r\n }\r\n\r\n // 3. Create the content\r\n this._html.contentWrapper = newElement(\r\n 'frame',\r\n 'content-wrapper'\r\n );\r\n this._html.content = newElement(\r\n 'content'\r\n );\r\n if (this._opts.content) {\r\n setHTML(this._html.content, this._opts.content);\r\n }\r\n\r\n // 4. Create the close button\r\n if (this._opts.showCloseButton) {\r\n if (this._opts.closeButtonMarkup) {\r\n const d = document.createElement('div');\r\n setHTML(d, this._opts.closeButtonMarkup);\r\n this._html.closeButton = d.firstChild;\r\n } else {\r\n this._html.closeButton = document.createElement('button');\r\n this._html.closeButton.setAttribute('type', 'button');\r\n this._html.closeButton.innerHTML = '×';\r\n applyCss(this._html.closeButton, ['close-button']);\r\n }\r\n this._html.contentWrapper.appendChild(this._html.closeButton);\r\n }\r\n this._html.contentWrapper.appendChild(this._html.content);\r\n this._html.wrapper.appendChild(this._html.contentWrapper);\r\n\r\n // 5. Create the pointer\r\n if (this._opts.pointer) {\r\n if (this._opts.border) {\r\n this._html.pointerBorder = newElement(\r\n `pointer-${this._opts.placement}`,\r\n `pointer-border-${this._opts.placement}`\r\n );\r\n this._html.wrapper.appendChild(this._html.pointerBorder);\r\n }\r\n this._html.pointerBg = newElement(\r\n `pointer-${this._opts.placement}`,\r\n `pointer-bg-${this._opts.placement}`\r\n );\r\n this._html.wrapper.appendChild(this._html.pointerBg);\r\n }\r\n\r\n // Create an outer wrapper\r\n this._html.floatWrapper = newElement(\r\n 'float-wrapper'\r\n );\r\n this._html.floatWrapper.appendChild(this._html.wrapper);\r\n\r\n // Add the wrapper to the Google Maps float pane\r\n this.getPanes().floatPane.appendChild(this._html.floatWrapper);\r\n\r\n // Now add all the event listeners\r\n const map = this.getMap();\r\n this.clearListeners();\r\n if (this._opts.closeOnMapClick) {\r\n this.trackListener(google.maps.event.addListener(map, 'click', () => {\r\n this.close();\r\n }));\r\n }\r\n if (this._opts.closeWhenOthersOpen) {\r\n this.trackListener(google.maps.event.addListener(map, `${_eventPrefix}opened`, (other) => {\r\n if (this !== other) {\r\n this.close();\r\n }\r\n }));\r\n }\r\n if (google) {\r\n // Clear out the previous map bounds\r\n this._previousWidth = null;\r\n this._previousHeight = null;\r\n this.trackListener(google.maps.event.addListener(map, 'bounds_changed', () => {\r\n const d = map.getDiv();\r\n const ow = d.offsetWidth;\r\n const oh = d.offsetHeight;\r\n const pw = this._previousWidth;\r\n const ph = this._previousHeight;\r\n if (pw === null || ph === null || pw !== ow || ph !== oh) {\r\n this._previousWidth = ow;\r\n this._previousHeight = oh;\r\n this.resize();\r\n }\r\n }));\r\n\r\n // Marker moves\r\n if (this._marker) {\r\n this.trackListener(google.maps.event.addListener(this._marker,\r\n 'position_changed', () => {\r\n this.draw();\r\n }));\r\n }\r\n\r\n // Close button\r\n if (this._opts.showCloseButton && !this._opts.closeButtonMarkup) {\r\n this.trackListener(google.maps.event.addDomListener(this._html.closeButton,\r\n 'click', (e) => {\r\n e.cancelBubble = true;\r\n if (e.stopPropagation) {\r\n e.stopPropagation();\r\n }\r\n this.close();\r\n }));\r\n }\r\n\r\n // Stop the mouse event propagation\r\n const mouseEvents = ['click', 'dblclick', 'rightclick', 'contextmenu',\r\n 'drag', 'dragend', 'dragstart',\r\n 'mousedown', 'mouseout', 'mouseover', 'mouseup',\r\n 'touchstart', 'touchend', 'touchmove',\r\n 'wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];\r\n mouseEvents.forEach((event) => {\r\n this.trackListener(google.maps.event.addDomListener(this._html.wrapper,\r\n event, (e) => {\r\n e.cancelBubble = true;\r\n if (e.stopPropagation) {\r\n e.stopPropagation();\r\n }\r\n }));\r\n });\r\n }\r\n\r\n\r\n this.activateCallback('open');\r\n }\r\n\r\n // Implementation of OverlayView onRemove method\r\n onRemove() {\r\n this.activateCallback('close');\r\n if (this._html) {\r\n const parent = this._html.floatWrapper.parentElement;\r\n if (parent) {\r\n parent.removeChild(this._html.floatWrapper);\r\n }\r\n this._html = null;\r\n }\r\n this._isOpen = false;\r\n this.activateCallback('afterClose');\r\n }\r\n\r\n // The map inner bounds used for panning and resizing\r\n getMapInnerBounds() {\r\n const mb = this.getMap().getDiv().getBoundingClientRect();\r\n const mib = {\r\n top: mb.top + this._opts.edgeOffset.top,\r\n right: mb.right - this._opts.edgeOffset.right,\r\n bottom: mb.bottom - this._opts.edgeOffset.bottom,\r\n left: mb.left + this._opts.edgeOffset.left\r\n };\r\n mib.width = mib.right - mib.left;\r\n mib.height = mib.bottom - mib.top;\r\n return mib;\r\n }\r\n\r\n // Pan the Google Map such that the info window is visible\r\n reposition() {\r\n if (!this._opts.panOnOpen || !this._html) {\r\n return;\r\n }\r\n const mib = this.getMapInnerBounds();\r\n const wb = this._html.wrapper.getBoundingClientRect();\r\n let dx = 0;\r\n let dy = 0;\r\n if (mib.left >= wb.left) {\r\n dx = wb.left - mib.left;\r\n } else if (mib.right <= wb.right) {\r\n dx = wb.left - (mib.right - wb.width);\r\n }\r\n if (mib.top >= wb.top) {\r\n dy = wb.top - mib.top;\r\n } else if (mib.bottom <= wb.bottom) {\r\n dy = wb.top - (mib.bottom - wb.height);\r\n }\r\n if (dx !== 0 || dy !== 0) {\r\n this.getMap().panBy(dx, dy);\r\n }\r\n }\r\n\r\n // Resize the info window to fit within the map bounds and edge offset\r\n resize() {\r\n if (!this._html) {\r\n return;\r\n }\r\n const mib = this.getMapInnerBounds();\r\n // Handle the max width\r\n let maxWidth = mib.width;\r\n if (this._opts.maxWidth !== undefined) {\r\n maxWidth = Math.min(maxWidth, this._opts.maxWidth);\r\n }\r\n maxWidth -= (this._html.wrapper.offsetWidth - this._html.content.offsetWidth);\r\n this._html.content.style.maxWidth = `${maxWidth}px`;\r\n\r\n // Handle the max height\r\n let maxHeight = mib.height;\r\n if (this._opts.maxHeight !== undefined) {\r\n maxHeight = Math.min(maxHeight, this._opts.maxHeight);\r\n }\r\n maxHeight -= (this._html.wrapper.offsetHeight - this._html.content.offsetHeight);\r\n this._html.content.style.maxHeight = `${maxHeight}px`;\r\n }\r\n}\r\n"]} \ No newline at end of file +{"version":3,"sources":["snazzy-info-window.js"],"names":["copyKeys","target","source","Object","keys","forEach","key","mergeDefaultOptions","opts","copy","_defaultOptions","obj","_typeof","objCopy","parseAttribute","attribute","defaultValue","re","test","match","exec","value","units","original","setHTML","container","content","firstChild","removeChild","innerHTML","appendChild","oppositePlacement","p","capitalizePlacement","charAt","toUpperCase","slice","toLatLng","v","undefined","google","maps","LatLng","lat","lng","_defaultShadow","h","blur","spread","color","placement","pointer","openOnMarkerClick","closeOnMapClick","closeWhenOthersOpen","showCloseButton","panOnOpen","edgeOffset","top","right","bottom","left","SnazzyInfoWindow","_classCallCheck","this","_this","_possibleConstructorReturn","__proto__","getPrototypeOf","call","console","warn","_html","_opts","_callbacks","callbacks","_marker","marker","_map","map","_position","position","_isOpen","_listeners","trackListener","event","addListener","getMap","open","offset","String","toLowerCase","border","shadow","callback","lambda","apply","listener","persistent","push","clearPersistent","e","removeListener","filter","result","activateCallback","setMap","clearListeners","latLng","draw","resize","reposition","wrapperClass","wrapper","w","className","_classPrefix","style","marginLeft","marginTop","bg","backgroundColor","contentWrapper","pointerBg","padding","shadowFrame","borderRadius","fontSize","fontColor","shadowPointer","width","height","pointerBorder","borderWidth","bWidth","Math","round","offsetWidth","clientWidth","pLength","min","offsetHeight","triangleDiff","reverseP","borderColor","isSet","hOffset","vOffset","formatBoxShadow","boxShadow","hRotated","vRotated","shadowPointerInner","opacity","shadowWrapper","divPixel","getProjection","fromLatLngToDivPixel","floatWrapper","floor","y","x","trigger","_eventPrefix","_this2","applyCss","element","args","i","length","newElement","_len","arguments","Array","_key","document","createElement","setWrapperClass","closeButtonMarkup","d","closeButton","setAttribute","getPanes","floatPane","close","other","_previousWidth","_previousHeight","getDiv","ow","oh","pw","ph","addDomListener","cancelBubble","stopPropagation","parent","parentElement","mb","getBoundingClientRect","mib","getMapInnerBounds","wb","dx","dy","panBy","maxWidth","maxHeight","OverlayView"],"mappings":"k0BA6BA,QAASA,GAASC,EAAQC,GAClBD,GAAUC,GACVC,OAAOC,KAAKF,GAAQG,QAAQ,SAACC,GACzBL,EAAOK,GAAOJ,EAAOI,KAOjC,QAASC,GAAoBC,GACzB,GAAMC,KAYN,OAXAT,GAASS,EAAMC,GACfV,EAASS,EAAMD,GACfL,OAAOC,KAAKM,GAAiBL,QAAQ,SAACC,GAClC,GAAMK,GAAMD,EAAgBJ,EAC5B,IAAmB,YAAf,SAAOK,EAAP,YAAAC,EAAOD,IAAkB,CACzB,GAAME,KACNb,GAASa,EAASF,GAClBX,EAASa,EAASJ,EAAKH,IACvBG,EAAKH,GAAOO,KAGbJ,EAIX,QAASK,GAAeC,EAAWC,GAE/B,GAAMC,GAAK,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B,IAAPwE,GAAmB,IAAPC,GACZ5I,KAAKuB,SAASsH,MAAMF,EAAIC,qCAM5B,GAAK5I,KAAKQ,MAAV,CAGA,GAAMgI,GAAMxI,KAAKyI,oBAEbK,EAAWN,EAAItE,KACS3F,UAAxByB,KAAKS,MAAMqI,WACXA,EAAWvE,KAAKK,IAAIkE,EAAU9I,KAAKS,MAAMqI,WAE7CA,GAAa9I,KAAKQ,MAAMyC,QAAQwB,YAAczE,KAAKQ,MAAM9C,QAAQ+G,YACjEzE,KAAKQ,MAAM9C,QAAQ2F,MAAMyF,SAAcA,EAAvC,IAGA,IAAIC,GAAYP,EAAIrE,MACS5F,UAAzByB,KAAKS,MAAMsI,YACXA,EAAYxE,KAAKK,IAAImE,EAAW/I,KAAKS,MAAMsI,YAE/CA,GAAc/I,KAAKQ,MAAMyC,QAAQ4B,aAAe7E,KAAKQ,MAAM9C,QAAQmH,aACnE7E,KAAKQ,MAAM9C,QAAQ2F,MAAM0F,UAAeA,EAAxC,aA7jBe,WACnB,MAAyB,mBAAXvK,QAAyBA,OAAOC,KAAKuK,YAAc,2BAEhDlJ","file":"snazzy-info-window.min.js","sourcesContent":["// Global variables\nconst _classPrefix = 'si-';\nconst _root2 = 1.41421356237;\nconst _inverseRoot2 = 0.7071067811865474;\nconst _eventPrefix = 'snazzy-info-window-';\nconst _defaultShadow = {\n h: '0px',\n v: '3px',\n blur: '6px',\n spread: '0px',\n color: '#000'\n};\nconst _defaultOptions = {\n placement: 'top',\n pointer: true,\n openOnMarkerClick: true,\n closeOnMapClick: true,\n closeWhenOthersOpen: false,\n showCloseButton: true,\n panOnOpen: true,\n edgeOffset: {\n top: 20,\n right: 20,\n bottom: 20,\n left: 20\n }\n};\n\n// Copy keys from the source into the target\nfunction copyKeys(target, source) {\n if (target && source) {\n Object.keys(source).forEach((key) => {\n target[key] = source[key];\n });\n }\n}\n\n// We need to safely merge options from the defaults. This will make\n// sure settings like edgeOffset are properly assigned.\nfunction mergeDefaultOptions(opts) {\n const copy = {};\n copyKeys(copy, _defaultOptions);\n copyKeys(copy, opts);\n Object.keys(_defaultOptions).forEach((key) => {\n const obj = _defaultOptions[key];\n if (typeof obj === 'object') {\n const objCopy = {};\n copyKeys(objCopy, obj);\n copyKeys(objCopy, copy[key]);\n copy[key] = objCopy;\n }\n });\n return copy;\n}\n\n// Parse a css attribute into the numeric portion and the units\nfunction parseAttribute(attribute, defaultValue) {\n // 1em, 1.0em, 0.1em, .1em, 1. em\n const re = /^(-{0,1}\\.{0,1}\\d+(\\.\\d+)?)[\\s|\\.]*(\\w*)$/;\n if (attribute && re.test(attribute)) {\n const match = re.exec(attribute);\n const number = match[1];\n const units = match[3] || 'px';\n return { value: number * 1, units, original: attribute };\n }\n if (defaultValue) {\n return parseAttribute(defaultValue);\n }\n return { original: defaultValue };\n}\n\n// Set the html of a container. Should support both raw text and a single\n// DOM Element.\nfunction setHTML(container, content) {\n if (container) {\n // Clear out everything in the container\n while (container.firstChild) {\n container.removeChild(container.firstChild);\n }\n if (content) {\n if (typeof content === 'string') {\n container.innerHTML = content;\n } else {\n container.appendChild(content);\n }\n }\n }\n}\n\n// Get the opposite of a given placement\nfunction oppositePlacement(p) {\n if (p === 'top') {\n return 'bottom';\n } else if (p === 'bottom') {\n return 'top';\n } else if (p === 'left') {\n return 'right';\n } else if (p === 'right') {\n return 'left';\n }\n return p;\n}\n\n// Return the placement with the first letter capitalized\nfunction capitalizePlacement(p) {\n return p.charAt(0).toUpperCase() + p.slice(1);\n}\n\n// Convert the value into a Google Map LatLng\nfunction toLatLng(v) {\n if (v !== undefined && v !== null) {\n if (v instanceof google.maps.LatLng) {\n return v;\n } else if (v.lat !== undefined && v.lng !== undefined) {\n return new google.maps.LatLng(v);\n }\n }\n return null;\n}\n\n// Export SnazzyInfoWindow even if google is not yet defined.\nconst getGoogleClass = () => {\n return typeof google !== 'undefined' ? google.maps.OverlayView : function noop() {};\n};\nexport default class SnazzyInfoWindow extends getGoogleClass() {\n\n constructor(opts) {\n super(opts);\n if (typeof google === 'undefined') {\n console.warn('Snazzy Info Window: Google Maps is not defined!'); //eslint-disable-line\n return;\n }\n // Private properties\n this._html = null;\n this._opts = mergeDefaultOptions(opts);\n this._callbacks = this._opts.callbacks || {};\n this._marker = this._opts.marker;\n this._map = this._opts.map;\n this._position = toLatLng(this._opts.position);\n this._isOpen = false;\n this._listeners = [];\n\n // This listener remains active when the info window is closed.\n if (this._marker && this._opts.openOnMarkerClick) {\n this.trackListener(google.maps.event.addListener(this._marker, 'click', () => {\n if (!this.getMap()) {\n this.open();\n }\n }), true);\n }\n\n // When using a position the default option for the offset is 0\n if (this._position && !this._opts.offset) {\n this._opts.offset = {\n top: '0px',\n left: '0px'\n };\n }\n\n // Validate the placement option\n let p = opts.placement || this._opts.position;\n // The position variable was renamed to placement so we must type check\n if (typeof p === 'string' || p instanceof String) {\n p = p.toLowerCase();\n }\n if (p !== 'top' && p !== 'bottom' &&\n p !== 'left' && p !== 'right') {\n this._opts.placement = _defaultOptions.placement;\n } else {\n this._opts.placement = p;\n }\n\n // Validate the position option\n p = this._opts.position;\n if (p !== undefined && p !== null &&\n typeof p !== 'string' && !(p instanceof String)) {\n this._opts.position = p;\n }\n\n // Validate the other options\n if (this._opts.border === undefined || this._opts.border === true) {\n this._opts.border = {};\n }\n if (this._opts.pointer === undefined) {\n this._opts.pointer = _defaultOptions.pointer;\n }\n if (this._opts.shadow === undefined || this._opts.shadow === true) {\n this._opts.shadow = {};\n }\n }\n\n // Activate the specified callback and return the result\n activateCallback(callback) {\n const lambda = this._callbacks[callback];\n return lambda ? lambda.apply(this) : undefined;\n }\n\n // Track the provided listener. A persistent listener means it remains\n // tracked even if the info window is closed.\n trackListener(listener, persistent) {\n this._listeners.push({ listener, persistent });\n }\n\n // Will clear all listeners that are used during the open state.\n clearListeners(clearPersistent) {\n if (this._listeners) {\n this._listeners.forEach((e) => {\n if (clearPersistent || !e.persistent) {\n google.maps.event.removeListener(e.listener);\n e.listener = null;\n }\n });\n this._listeners = this._listeners.filter((e) => {\n return e.listener != null;\n });\n }\n }\n\n isOpen() {\n return this._isOpen;\n }\n\n // Open the info window after attaching to a specific marker.\n open() {\n const result = this.activateCallback('beforeOpen');\n if (result !== undefined && !result) {\n return;\n }\n if (this._marker) {\n this.setMap(this._marker.getMap());\n } else if (this._map && this._position) {\n this.setMap(this._map);\n }\n }\n\n // Close the info window.\n close() {\n const result = this.activateCallback('beforeClose');\n if (result !== undefined && !result) {\n return;\n }\n this.clearListeners();\n this.setMap(null);\n }\n\n // Force close the map and remove any event listeners attached to google\n destroy() {\n if (this.getMap()) {\n this.setMap(null);\n }\n // Make sure to clear all persistent listeners\n this.clearListeners(true);\n }\n\n setContent(content) {\n this._opts.content = content;\n if (this._html && this._html.content) {\n setHTML(this._html.content, content);\n }\n }\n\n setPosition(latLng) {\n this._position = toLatLng(latLng);\n if (this._isOpen && this._position) {\n this.draw();\n this.resize();\n this.reposition();\n }\n }\n\n setWrapperClass(wrapperClass) {\n if (this._html && this._html.wrapper) {\n const w = this._html.wrapper;\n w.className = `${_classPrefix}wrapper-${this._opts.placement}`;\n if (this._opts.border) {\n w.className += ` ${_classPrefix}has-border`;\n }\n if (wrapperClass) {\n w.className += ` ${wrapperClass}`;\n }\n }\n this._opts.wrapperClass = wrapperClass;\n }\n\n getWrapper() {\n if (this._html) {\n return this._html.wrapper;\n }\n return null;\n }\n\n // Implementation of OverlayView draw method.\n draw() {\n if (!this.getMap() || !this._html) {\n return;\n }\n if (!this._marker && !this._position) {\n return;\n }\n\n // 1. Assign offset\n const offset = this._opts.offset;\n if (offset) {\n if (offset.left) {\n this._html.wrapper.style.marginLeft = offset.left;\n }\n if (offset.top) {\n this._html.wrapper.style.marginTop = offset.top;\n }\n }\n // 2. Set the background color\n const bg = this._opts.backgroundColor;\n if (bg) {\n this._html.contentWrapper.style.backgroundColor = bg;\n if (this._opts.pointer) {\n this._html.pointerBg.style[`border${capitalizePlacement(this._opts.placement)}Color`] = bg;\n }\n }\n // 3. Padding\n if (this._opts.padding) {\n this._html.contentWrapper.style.padding = this._opts.padding;\n if (this._opts.shadow) {\n this._html.shadowFrame.style.padding = this._opts.padding;\n }\n }\n // 4. Border radius\n if (this._opts.borderRadius) {\n this._html.contentWrapper.style.borderRadius = this._opts.borderRadius;\n if (this._opts.shadow) {\n this._html.shadowFrame.style.borderRadius = this._opts.borderRadius;\n }\n }\n // 5. Font Size\n if (this._opts.fontSize) {\n this._html.wrapper.style.fontSize = this._opts.fontSize;\n }\n // 6. Font Color\n if (this._opts.fontColor) {\n this._html.contentWrapper.style.color = this._opts.fontColor;\n }\n // 7. Pointer\n // Check if the pointer is enabled. Also make sure the value isn't just the boolean true.\n if (this._opts.pointer && this._opts.pointer !== true) {\n if (this._opts.shadow) {\n this._html.shadowPointer.style.width = this._opts.pointer;\n this._html.shadowPointer.style.height = this._opts.pointer;\n }\n if (this._html.pointerBorder) {\n this._html.pointerBorder.style.borderWidth = this._opts.pointer;\n }\n this._html.pointerBg.style.borderWidth = this._opts.pointer;\n }\n\n // 8. Border\n if (this._opts.border) {\n // Calculate the border width\n let bWidth = 0;\n if (this._opts.border.width !== undefined) {\n bWidth = parseAttribute(this._opts.border.width, '0px');\n this._html.contentWrapper.style.borderWidth = bWidth.value + bWidth.units;\n }\n bWidth = Math.round((this._html.contentWrapper.offsetWidth -\n this._html.contentWrapper.clientWidth) / 2.0);\n bWidth = parseAttribute(`${bWidth}px`, '0px');\n\n if (this._opts.pointer) {\n // Calculate the pointer length\n let pLength = Math.min(this._html.pointerBorder.offsetHeight,\n this._html.pointerBorder.offsetWidth);\n pLength = parseAttribute(`${pLength}px`, '0px');\n\n let triangleDiff = Math.round(bWidth.value * (_root2 - 1));\n triangleDiff = Math.min(triangleDiff, pLength.value);\n\n this._html.pointerBg.style.borderWidth =\n (pLength.value - triangleDiff) + pLength.units;\n\n const reverseP = capitalizePlacement(oppositePlacement(this._opts.placement));\n this._html.pointerBg.style[`margin${reverseP}`] =\n triangleDiff + bWidth.units;\n this._html.pointerBg.style[this._opts.placement] =\n -bWidth.value + bWidth.units;\n }\n const color = this._opts.border.color;\n if (color) {\n this._html.contentWrapper.style.borderColor = color;\n if (this._html.pointerBorder) {\n this._html.pointerBorder.style[`border${capitalizePlacement(this._opts.placement)}Color`] = color;\n }\n }\n }\n // 9. Shadow\n if (this._opts.shadow) {\n // Check if any of the shadow settings have actually been set\n const shadow = this._opts.shadow;\n const isSet = (attribute) => {\n const v = shadow[attribute];\n return v !== undefined && v != null;\n };\n\n if (isSet('h') || isSet('v') || isSet('blur') || isSet('spread') || isSet('color')) {\n const hOffset = parseAttribute(shadow.h, _defaultShadow.h);\n const vOffset = parseAttribute(shadow.v, _defaultShadow.v);\n const blur = parseAttribute(shadow.blur, _defaultShadow.blur);\n const spread = parseAttribute(shadow.spread, _defaultShadow.spread);\n const color = shadow.color || _defaultShadow.color;\n const formatBoxShadow = (h, v) => {\n return `${h} ${v} ${blur.original} ${spread.original} ${color}`;\n };\n\n this._html.shadowFrame.style.boxShadow =\n formatBoxShadow(hOffset.original, vOffset.original);\n\n // Correctly rotate the shadows before the css transform\n const hRotated = (_inverseRoot2 * (hOffset.value - vOffset.value)) + hOffset.units;\n const vRotated = (_inverseRoot2 * (hOffset.value + vOffset.value)) + vOffset.units;\n if (this._html.shadowPointerInner) {\n this._html.shadowPointerInner.style.boxShadow =\n formatBoxShadow(hRotated, vRotated);\n }\n }\n if (this._opts.shadow.opacity) {\n this._html.shadowWrapper.style.opacity = this._opts.shadow.opacity;\n }\n }\n\n const divPixel = this.getProjection()\n .fromLatLngToDivPixel(this._position || this._marker.position);\n if (divPixel) {\n this._html.floatWrapper.style.top = `${Math.floor(divPixel.y)}px`;\n this._html.floatWrapper.style.left = `${Math.floor(divPixel.x)}px`;\n }\n if (!this._isOpen) {\n this._isOpen = true;\n this.resize();\n this.reposition();\n this.activateCallback('afterOpen');\n google.maps.event.trigger(this.getMap(), `${_eventPrefix}opened`, this);\n }\n }\n\n // Implementation of OverlayView onAdd method.\n onAdd() {\n if (this._html) {\n return;\n }\n // Used for creating new elements\n const applyCss = (element, args) => {\n if (element && args) {\n for (let i = 0; i < args.length; i++) {\n const className = args[i];\n if (className) {\n if (element.className) {\n element.className += ' ';\n }\n element.className += _classPrefix + className;\n }\n }\n }\n };\n const newElement = (...args) => {\n const element = document.createElement('div');\n applyCss(element, args);\n return element;\n };\n\n this._html = {};\n\n // 1. Create the wrapper\n this._html.wrapper = newElement();\n this.setWrapperClass(this._opts.wrapperClass);\n\n // 2. Create the shadow\n if (this._opts.shadow) {\n this._html.shadowWrapper = newElement(\n `shadow-wrapper-${this._opts.placement}`\n );\n this._html.shadowFrame = newElement(\n 'frame',\n 'shadow-frame'\n );\n this._html.shadowWrapper.appendChild(this._html.shadowFrame);\n\n if (this._opts.pointer) {\n this._html.shadowPointer = newElement(\n `shadow-pointer-${this._opts.placement}`\n );\n this._html.shadowPointerInner = newElement(\n `shadow-inner-pointer-${this._opts.placement}`\n );\n this._html.shadowPointer.appendChild(this._html.shadowPointerInner);\n this._html.shadowWrapper.appendChild(this._html.shadowPointer);\n }\n\n this._html.wrapper.appendChild(this._html.shadowWrapper);\n }\n\n // 3. Create the content\n this._html.contentWrapper = newElement(\n 'frame',\n 'content-wrapper'\n );\n this._html.content = newElement(\n 'content'\n );\n if (this._opts.content) {\n setHTML(this._html.content, this._opts.content);\n }\n\n // 4. Create the close button\n if (this._opts.showCloseButton) {\n if (this._opts.closeButtonMarkup) {\n const d = document.createElement('div');\n setHTML(d, this._opts.closeButtonMarkup);\n this._html.closeButton = d.firstChild;\n } else {\n this._html.closeButton = document.createElement('button');\n this._html.closeButton.setAttribute('type', 'button');\n this._html.closeButton.innerHTML = '×';\n applyCss(this._html.closeButton, ['close-button']);\n }\n this._html.contentWrapper.appendChild(this._html.closeButton);\n }\n this._html.contentWrapper.appendChild(this._html.content);\n this._html.wrapper.appendChild(this._html.contentWrapper);\n\n // 5. Create the pointer\n if (this._opts.pointer) {\n if (this._opts.border) {\n this._html.pointerBorder = newElement(\n `pointer-${this._opts.placement}`,\n `pointer-border-${this._opts.placement}`\n );\n this._html.wrapper.appendChild(this._html.pointerBorder);\n }\n this._html.pointerBg = newElement(\n `pointer-${this._opts.placement}`,\n `pointer-bg-${this._opts.placement}`\n );\n this._html.wrapper.appendChild(this._html.pointerBg);\n }\n\n // Create an outer wrapper\n this._html.floatWrapper = newElement(\n 'float-wrapper'\n );\n this._html.floatWrapper.appendChild(this._html.wrapper);\n\n // Add the wrapper to the Google Maps float pane\n this.getPanes().floatPane.appendChild(this._html.floatWrapper);\n\n // Now add all the event listeners\n const map = this.getMap();\n this.clearListeners();\n if (this._opts.closeOnMapClick) {\n this.trackListener(google.maps.event.addListener(map, 'click', () => {\n this.close();\n }));\n }\n if (this._opts.closeWhenOthersOpen) {\n this.trackListener(google.maps.event.addListener(map, `${_eventPrefix}opened`, (other) => {\n if (this !== other) {\n this.close();\n }\n }));\n }\n\n // Clear out the previous map bounds\n this._previousWidth = null;\n this._previousHeight = null;\n this.trackListener(google.maps.event.addListener(map, 'bounds_changed', () => {\n const d = map.getDiv();\n const ow = d.offsetWidth;\n const oh = d.offsetHeight;\n const pw = this._previousWidth;\n const ph = this._previousHeight;\n if (pw === null || ph === null || pw !== ow || ph !== oh) {\n this._previousWidth = ow;\n this._previousHeight = oh;\n this.resize();\n }\n }));\n\n // Marker moves\n if (this._marker) {\n this.trackListener(google.maps.event.addListener(this._marker,\n 'position_changed', () => {\n this.draw();\n }));\n }\n\n // Close button\n if (this._opts.showCloseButton && !this._opts.closeButtonMarkup) {\n this.trackListener(google.maps.event.addDomListener(this._html.closeButton,\n 'click', (e) => {\n e.cancelBubble = true;\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n this.close();\n }));\n }\n\n // Stop the mouse event propagation\n const mouseEvents = ['click', 'dblclick', 'rightclick', 'contextmenu',\n 'drag', 'dragend', 'dragstart',\n 'mousedown', 'mouseout', 'mouseover', 'mouseup',\n 'touchstart', 'touchend', 'touchmove',\n 'wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];\n mouseEvents.forEach((event) => {\n this.trackListener(google.maps.event.addDomListener(this._html.wrapper,\n event, (e) => {\n e.cancelBubble = true;\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n }));\n });\n\n this.activateCallback('open');\n }\n\n // Implementation of OverlayView onRemove method\n onRemove() {\n this.activateCallback('close');\n if (this._html) {\n const parent = this._html.floatWrapper.parentElement;\n if (parent) {\n parent.removeChild(this._html.floatWrapper);\n }\n this._html = null;\n }\n this._isOpen = false;\n this.activateCallback('afterClose');\n }\n\n // The map inner bounds used for panning and resizing\n getMapInnerBounds() {\n const mb = this.getMap().getDiv().getBoundingClientRect();\n const mib = {\n top: mb.top + this._opts.edgeOffset.top,\n right: mb.right - this._opts.edgeOffset.right,\n bottom: mb.bottom - this._opts.edgeOffset.bottom,\n left: mb.left + this._opts.edgeOffset.left\n };\n mib.width = mib.right - mib.left;\n mib.height = mib.bottom - mib.top;\n return mib;\n }\n\n // Pan the Google Map such that the info window is visible\n reposition() {\n if (!this._opts.panOnOpen || !this._html) {\n return;\n }\n const mib = this.getMapInnerBounds();\n const wb = this._html.wrapper.getBoundingClientRect();\n let dx = 0;\n let dy = 0;\n if (mib.left >= wb.left) {\n dx = wb.left - mib.left;\n } else if (mib.right <= wb.right) {\n dx = wb.left - (mib.right - wb.width);\n }\n if (mib.top >= wb.top) {\n dy = wb.top - mib.top;\n } else if (mib.bottom <= wb.bottom) {\n dy = wb.top - (mib.bottom - wb.height);\n }\n if (dx !== 0 || dy !== 0) {\n this.getMap().panBy(dx, dy);\n }\n }\n\n // Resize the info window to fit within the map bounds and edge offset\n resize() {\n if (!this._html) {\n return;\n }\n const mib = this.getMapInnerBounds();\n // Handle the max width\n let maxWidth = mib.width;\n if (this._opts.maxWidth !== undefined) {\n maxWidth = Math.min(maxWidth, this._opts.maxWidth);\n }\n maxWidth -= (this._html.wrapper.offsetWidth - this._html.content.offsetWidth);\n this._html.content.style.maxWidth = `${maxWidth}px`;\n\n // Handle the max height\n let maxHeight = mib.height;\n if (this._opts.maxHeight !== undefined) {\n maxHeight = Math.min(maxHeight, this._opts.maxHeight);\n }\n maxHeight -= (this._html.wrapper.offsetHeight - this._html.content.offsetHeight);\n this._html.content.style.maxHeight = `${maxHeight}px`;\n }\n}\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 3199be0..53ba14e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "snazzy-info-window", "description": "Customizable info windows using the Google Maps JavaScript API.", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/atmist/snazzy-info-window", "bugs": { "url": "https://github.com/atmist/snazzy-info-window/issues"