@react-google-maps/infobox
Advanced tools
Comparing version 2.6.0 to 2.8.0
@@ -56,3 +56,2 @@ 'use strict'; | ||
// the event from being passed on to the map. It is used for the contextmenu event. | ||
// eslint-disable-next-line @getify/proper-arrows/this | ||
var ignoreHandler = function (event) { | ||
@@ -77,3 +76,2 @@ event.returnValue = false; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -119,5 +117,3 @@ var panes = this.getPanes(); | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -163,3 +159,2 @@ _this.div.style.cursor = 'default'; | ||
var _this = this; | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
return function (event) { | ||
@@ -182,3 +177,2 @@ // 1.0.3 fix: Always prevent propagation of a close box click to the map: | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -197,6 +191,4 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -210,3 +202,2 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -256,3 +247,2 @@ var projection = this.getProjection(); | ||
if (boxStyle.hasOwnProperty(i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -269,3 +259,2 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -292,3 +281,3 @@ this.div.style.msFilter = | ||
} | ||
if (document.defaultView && document.defaultView.getComputedStyle) { | ||
if (document.defaultView) { | ||
var ownerDocument = this.div.ownerDocument; | ||
@@ -307,11 +296,8 @@ var computedStyle = ownerDocument && ownerDocument.defaultView | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var currentStyle = this.div.currentStyle; | ||
if (currentStyle) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// The current styles may not be in pixel units, but assume they are (bad!) | ||
@@ -335,3 +321,2 @@ bw.top = parseInt(currentStyle.borderTopWidth || '', 10) || 0; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -491,3 +476,2 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -519,9 +503,5 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// @ts-ignore | ||
@@ -531,6 +511,3 @@ var position = anchor.getPosition(); | ||
}); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// @ts-ignore | ||
@@ -540,3 +517,2 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -571,3 +547,2 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -580,6 +555,4 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -589,3 +562,2 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -592,0 +564,0 @@ return this; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,g=this.infoBoxClearance.height,c=this.getProjection().fromLatLngToContainerPixel(this.position);null!==c&&(c.x<-d+v?e=c.x+d-v:c.x+a+d+v>h&&(e=c.x+a+d+v-h),this.alignBottom?c.y<-r+g+p?s=c.y+r-g-p:c.y+r+g>l&&(s=c.y+r+g-l):c.y<-r+g?s=c.y+r-g:c.y+p+r+g>l&&(s=c.y+p+r+g-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView&&document.defaultView.getComputedStyle){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();exports.InfoBox=t; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,g=this.infoBoxClearance.height,c=this.getProjection().fromLatLngToContainerPixel(this.position);null!==c&&(c.x<-d+v?e=c.x+d-v:c.x+a+d+v>h&&(e=c.x+a+d+v-h),this.alignBottom?c.y<-r+g+p?s=c.y+r-g-p:c.y+r+g>l&&(s=c.y+r+g-l):c.y<-r+g?s=c.y+r-g:c.y+p+r+g>l&&(s=c.y+p+r+g-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();exports.InfoBox=t; | ||
//# sourceMappingURL=cjs.min.js.map |
@@ -52,3 +52,2 @@ var InfoBox = /** @class */ (function () { | ||
// the event from being passed on to the map. It is used for the contextmenu event. | ||
// eslint-disable-next-line @getify/proper-arrows/this | ||
var ignoreHandler = function (event) { | ||
@@ -73,3 +72,2 @@ event.returnValue = false; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -115,5 +113,3 @@ var panes = this.getPanes(); | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -159,3 +155,2 @@ _this.div.style.cursor = 'default'; | ||
var _this = this; | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
return function (event) { | ||
@@ -178,3 +173,2 @@ // 1.0.3 fix: Always prevent propagation of a close box click to the map: | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -193,6 +187,4 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -206,3 +198,2 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -252,3 +243,2 @@ var projection = this.getProjection(); | ||
if (boxStyle.hasOwnProperty(i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -265,3 +255,2 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -288,3 +277,3 @@ this.div.style.msFilter = | ||
} | ||
if (document.defaultView && document.defaultView.getComputedStyle) { | ||
if (document.defaultView) { | ||
var ownerDocument = this.div.ownerDocument; | ||
@@ -303,11 +292,8 @@ var computedStyle = ownerDocument && ownerDocument.defaultView | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var currentStyle = this.div.currentStyle; | ||
if (currentStyle) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// The current styles may not be in pixel units, but assume they are (bad!) | ||
@@ -331,3 +317,2 @@ bw.top = parseInt(currentStyle.borderTopWidth || '', 10) || 0; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -487,3 +472,2 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -515,9 +499,5 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// @ts-ignore | ||
@@ -527,6 +507,3 @@ var position = anchor.getPosition(); | ||
}); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// @ts-ignore | ||
@@ -536,3 +513,2 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -567,3 +543,2 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -576,6 +551,4 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -585,3 +558,2 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -588,0 +560,0 @@ return this; |
@@ -1,2 +0,2 @@ | ||
var t=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,g=this.infoBoxClearance.height,c=this.getProjection().fromLatLngToContainerPixel(this.position);null!==c&&(c.x<-d+v?e=c.x+d-v:c.x+a+d+v>h&&(e=c.x+a+d+v-h),this.alignBottom?c.y<-r+g+p?s=c.y+r-g-p:c.y+r+g>l&&(s=c.y+r+g-l):c.y<-r+g?s=c.y+r-g:c.y+p+r+g>l&&(s=c.y+p+r+g-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView&&document.defaultView.getComputedStyle){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();export{t as InfoBox}; | ||
var t=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,g=this.infoBoxClearance.height,c=this.getProjection().fromLatLngToContainerPixel(this.position);null!==c&&(c.x<-d+v?e=c.x+d-v:c.x+a+d+v>h&&(e=c.x+a+d+v-h),this.alignBottom?c.y<-r+g+p?s=c.y+r-g-p:c.y+r+g>l&&(s=c.y+r+g-l):c.y<-r+g?s=c.y+r-g:c.y+p+r+g>l&&(s=c.y+p+r+g-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();export{t as InfoBox}; | ||
//# sourceMappingURL=esm.min.js.map |
@@ -58,3 +58,2 @@ (function (global, factory) { | ||
// the event from being passed on to the map. It is used for the contextmenu event. | ||
// eslint-disable-next-line @getify/proper-arrows/this | ||
var ignoreHandler = function (event) { | ||
@@ -79,3 +78,2 @@ event.returnValue = false; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -121,5 +119,3 @@ var panes = this.getPanes(); | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -165,3 +161,2 @@ _this.div.style.cursor = 'default'; | ||
var _this = this; | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
return function (event) { | ||
@@ -184,3 +179,2 @@ // 1.0.3 fix: Always prevent propagation of a close box click to the map: | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -199,6 +193,4 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -212,3 +204,2 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -258,3 +249,2 @@ var projection = this.getProjection(); | ||
if (boxStyle.hasOwnProperty(i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -271,3 +261,2 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -294,3 +283,3 @@ this.div.style.msFilter = | ||
} | ||
if (document.defaultView && document.defaultView.getComputedStyle) { | ||
if (document.defaultView) { | ||
var ownerDocument = this.div.ownerDocument; | ||
@@ -309,11 +298,8 @@ var computedStyle = ownerDocument && ownerDocument.defaultView | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
var currentStyle = this.div.currentStyle; | ||
if (currentStyle) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// The current styles may not be in pixel units, but assume they are (bad!) | ||
@@ -337,3 +323,2 @@ bw.top = parseInt(currentStyle.borderTopWidth || '', 10) || 0; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -493,3 +478,2 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -521,9 +505,5 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// @ts-ignore | ||
@@ -533,6 +513,3 @@ var position = anchor.getPosition(); | ||
}); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', | ||
// eslint-disable-next-line @getify/proper-arrows/this, @getify/proper-arrows/name | ||
function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// @ts-ignore | ||
@@ -542,3 +519,2 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -573,3 +549,2 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -582,6 +557,4 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -591,3 +564,2 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
@@ -594,0 +566,0 @@ return this; |
@@ -1,2 +0,2 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).infoBox={})}(this,(function(t){"use strict";var i=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,f=this.infoBoxClearance.height,g=this.getProjection().fromLatLngToContainerPixel(this.position);null!==g&&(g.x<-d+v?e=g.x+d-v:g.x+a+d+v>h&&(e=g.x+a+d+v-h),this.alignBottom?g.y<-r+f+p?s=g.y+r-f-p:g.y+r+f>l&&(s=g.y+r+f-l):g.y<-r+f?s=g.y+r-f:g.y+p+r+f>l&&(s=g.y+p+r+f-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView&&document.defaultView.getComputedStyle){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();t.InfoBox=i,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).infoBox={})}(this,(function(t){"use strict";var i=function(){function t(i){void 0===i&&(i={}),this.extend(t,google.maps.OverlayView),this.content=i.content||"",this.disableAutoPan=i.disableAutoPan||!1,this.maxWidth=i.maxWidth||0,this.pixelOffset=i.pixelOffset||new google.maps.Size(0,0),this.position=i.position||new google.maps.LatLng(0,0),this.zIndex=i.zIndex||null,this.boxClass=i.boxClass||"infoBox",this.boxStyle=i.boxStyle||{},this.closeBoxMargin=i.closeBoxMargin||"2px",this.closeBoxURL=i.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===i.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=i.infoBoxClearance||new google.maps.Size(1,1),void 0===i.visible&&(void 0===i.isHidden?i.visible=!0:i.visible=!i.isHidden),this.isHidden=!i.visible,this.alignBottom=i.alignBottom||!1,this.pane=i.pane||"floatPane",this.enableEventPropagation=i.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var t=this;function i(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}if(!this.div){if(this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content)),this.getPanes()[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var e=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-e.left-e.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],o=0;o<s.length;o++)this.eventListeners.push(google.maps.event.addDomListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addDomListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addDomListener(this.div,"contextmenu",(function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),t.enableEventPropagation||i(e)})),google.maps.event.trigger(this,"domready")}},t.prototype.getCloseBoxImg=function(){var t="";return""!==this.closeBoxURL&&(t='<img alt=""',t+=' aria-hidden="true"',t+=" src='"+this.closeBoxURL+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin+";",t+="'>"),t},t.prototype.addClickHandler=function(){if(this.div&&this.div.firstChild&&""!==this.closeBoxURL){var t=this.div.firstChild;this.closeListener=google.maps.event.addDomListener(t,"click",this.getCloseClickHandler())}else this.closeListener=null},t.prototype.getCloseClickHandler=function(){var t=this;return function(i){i.cancelBubble=!0,i.stopPropagation&&i.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},t.prototype.panBox=function(t){if(this.div&&!t){var i=this.getMap();if(i instanceof google.maps.Map){var e=0,s=0,o=i.getBounds();o&&!o.contains(this.position)&&i.setCenter(this.position);var n=i.getDiv(),h=n.offsetWidth,l=n.offsetHeight,d=this.pixelOffset.width,r=this.pixelOffset.height,a=this.div.offsetWidth,p=this.div.offsetHeight,v=this.infoBoxClearance.width,f=this.infoBoxClearance.height,g=this.getProjection().fromLatLngToContainerPixel(this.position);null!==g&&(g.x<-d+v?e=g.x+d-v:g.x+a+d+v>h&&(e=g.x+a+d+v-h),this.alignBottom?g.y<-r+f+p?s=g.y+r-f-p:g.y+r+f>l&&(s=g.y+r+f-l):g.y<-r+f?s=g.y+r-f:g.y+p+r+f>l&&(s=g.y+p+r+f-l)),0===e&&0===s||i.panBy(e,s)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var t=this.boxStyle;for(var i in t)t.hasOwnProperty(i)&&(this.div.style[i]=t[i]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var e=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*e+')"',this.div.style.filter="alpha(opacity="+100*e+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var t={top:0,bottom:0,left:0,right:0};if(!this.div)return t;if(document.defaultView){var i=this.div.ownerDocument,e=i&&i.defaultView?i.defaultView.getComputedStyle(this.div,""):null;e&&(t.top=parseInt(e.borderTopWidth||"",10)||0,t.bottom=parseInt(e.borderBottomWidth||"",10)||0,t.left=parseInt(e.borderLeftWidth||"",10)||0,t.right=parseInt(e.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var s=this.div.currentStyle;s&&(t.top=parseInt(s.borderTopWidth||"",10)||0,t.bottom=parseInt(s.borderBottomWidth||"",10)||0,t.left=parseInt(s.borderLeftWidth||"",10)||0,t.right=parseInt(s.borderRightWidth||"",10)||0)}return t},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var t=this.getProjection().fromLatLngToDivPixel(this.position);null!==t&&(this.div.style.left=t.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(t.y+this.pixelOffset.height)+"px":this.div.style.top=t.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(t){void 0===t&&(t={}),void 0!==t.boxClass&&(this.boxClass=t.boxClass,this.setBoxStyle()),void 0!==t.boxStyle&&(this.boxStyle=t.boxStyle,this.setBoxStyle()),void 0!==t.content&&this.setContent(t.content),void 0!==t.disableAutoPan&&(this.disableAutoPan=t.disableAutoPan),void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.pixelOffset&&(this.pixelOffset=t.pixelOffset),void 0!==t.alignBottom&&(this.alignBottom=t.alignBottom),void 0!==t.position&&this.setPosition(t.position),void 0!==t.zIndex&&this.setZIndex(t.zIndex),void 0!==t.closeBoxMargin&&(this.closeBoxMargin=t.closeBoxMargin),void 0!==t.closeBoxURL&&(this.closeBoxURL=t.closeBoxURL),void 0!==t.infoBoxClearance&&(this.infoBoxClearance=t.infoBoxClearance),void 0!==t.isHidden&&(this.isHidden=t.isHidden),void 0!==t.visible&&(this.isHidden=!t.visible),void 0!==t.enableEventPropagation&&(this.enableEventPropagation=t.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(t){this.content=t,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof t?this.div.innerHTML=this.getCloseBoxImg()+t:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(t))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(t){this.position=t,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(t){this.isHidden=!t,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(t){this.zIndex=t,this.div&&(this.div.style.zIndex=t+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var t=this.getMap();return null!=t&&!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(t,i){var e=this;i&&(this.position=i.getPosition(),this.moveListener=google.maps.event.addListener(i,"position_changed",(function(){var t=i.getPosition();e.setPosition(t)})),this.mapListener=google.maps.event.addListener(i,"map_changed",(function(){e.setMap(i.map)}))),this.setMap(t),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var t=0;t<this.eventListeners.length;t++)google.maps.event.removeListener(this.eventListeners[t]);this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},t.prototype.extend=function(t,i){return function(t){for(var i in t.prototype)this.prototype.hasOwnProperty(i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();t.InfoBox=i,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=umd.min.js.map |
{ | ||
"name": "@react-google-maps/infobox", | ||
"sideEffects": false, | ||
"version": "2.6.0", | ||
"version": "2.8.0", | ||
"description": "InfoBox for React.js Google Maps API", | ||
@@ -55,13 +55,13 @@ "license": "MIT", | ||
"@getify/eslint-plugin-proper-arrows": "11.0.3", | ||
"@rollup/plugin-commonjs": "21.0.1", | ||
"@rollup/plugin-node-resolve": "13.0.6", | ||
"@rollup/plugin-typescript": "8.3.0", | ||
"@rollup/plugin-commonjs": "21.0.3", | ||
"@rollup/plugin-node-resolve": "13.1.3", | ||
"@rollup/plugin-typescript": "8.3.1", | ||
"@types/babel-types": "7.0.11", | ||
"@types/google.maps": "3.46.1", | ||
"@typescript-eslint/eslint-plugin": "5.3.1", | ||
"@typescript-eslint/parser": "5.3.1", | ||
"eslint": "7.32.0", | ||
"eslint-config-standard": "16.0.3", | ||
"eslint-config-standard-react": "11.0.1", | ||
"eslint-import-resolver-typescript": "2.5.0", | ||
"@types/google.maps": "3.48.3", | ||
"@typescript-eslint/eslint-plugin": "5.17.0", | ||
"@typescript-eslint/parser": "5.17.0", | ||
"eslint": "8.12.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-config-standard": "17.0.0-0", | ||
"eslint-import-resolver-typescript": "2.7.1", | ||
"eslint-plugin-ascii": "1.0.0", | ||
@@ -72,26 +72,32 @@ "eslint-plugin-babel": "5.3.1", | ||
"eslint-plugin-html": "6.2.0", | ||
"eslint-plugin-import": "2.25.2", | ||
"eslint-plugin-import": "2.25.4", | ||
"eslint-plugin-jest": "26.1.3", | ||
"eslint-plugin-jest-dom": "4.0.1", | ||
"eslint-plugin-json": "3.1.0", | ||
"eslint-plugin-jsx-a11y": "6.4.1", | ||
"eslint-plugin-jsx-a11y": "6.5.1", | ||
"eslint-plugin-n": "15.1.0", | ||
"eslint-plugin-no-inferred-method-name": "2.0.0", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-optimize-regex": "1.2.1", | ||
"eslint-plugin-promise": "5.1.1", | ||
"eslint-plugin-react": "7.26.1", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"eslint-plugin-promise": "6.0.0", | ||
"eslint-plugin-react": "7.29.4", | ||
"eslint-plugin-react-functional-set-state": "1.2.1", | ||
"eslint-plugin-react-hooks": "4.2.0", | ||
"eslint-plugin-react-perf": "3.3.0", | ||
"eslint-plugin-react-hooks": "4.4.0", | ||
"eslint-plugin-react-perf": "3.3.1", | ||
"eslint-plugin-security-node": "1.1.1", | ||
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0", | ||
"jest": "27.3.1", | ||
"jest-cli": "27.3.1", | ||
"jest": "27.5.1", | ||
"jest-cli": "27.5.1", | ||
"prettier": "2.6.2", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.59.0", | ||
"rollup-plugin-dts": "4.0.1", | ||
"rollup": "2.70.1", | ||
"rollup-plugin-dts": "4.2.0", | ||
"rollup-plugin-terser": "7.0.2", | ||
"ts-jest": "27.0.7", | ||
"typescript": "4.4.4" | ||
"ts-jest": "27.1.4", | ||
"typescript": "4.6.3" | ||
}, | ||
"gitHead": "80167ddcc3d8e356dbf0b0c3a6292c6a3a989f83" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
336483
45
2466