@react-google-maps/infobox
Advanced tools
Comparing version 2.8.0 to 2.10.0
@@ -75,2 +75,3 @@ 'use strict'; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -112,7 +113,7 @@ var panes = this.getPanes(); | ||
for (var i = 0; i < events.length; i++) { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, events[i], cancelHandler)); | ||
this.eventListeners.push(google.maps.event.addListener(this.div, events[i], cancelHandler)); | ||
} | ||
// Workaround for Google bug that causes the cursor to change to a pointer | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
this.eventListeners.push(google.maps.event.addListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -123,3 +124,3 @@ _this.div.style.cursor = 'default'; | ||
} | ||
this.contextListener = google.maps.event.addDomListener(this.div, 'contextmenu', ignoreHandler); | ||
this.contextListener = google.maps.event.addListener(this.div, 'contextmenu', ignoreHandler); | ||
/** | ||
@@ -151,3 +152,3 @@ * This event is fired when the DIV containing the InfoBox's content is attached to the DOM. | ||
var closeBox = this.div.firstChild; | ||
this.closeListener = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler()); | ||
this.closeListener = google.maps.event.addListener(closeBox, 'click', this.getCloseClickHandler()); | ||
} | ||
@@ -177,2 +178,3 @@ else { | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -191,4 +193,6 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -202,2 +206,3 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -246,3 +251,4 @@ var projection = this.getProjection(); | ||
for (var i in boxStyle) { | ||
if (boxStyle.hasOwnProperty(i)) { | ||
if (Object.prototype.hasOwnProperty.call(boxStyle, i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -259,2 +265,3 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -295,5 +302,7 @@ this.div.style.msFilter = | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -320,2 +329,3 @@ var currentStyle = this.div.currentStyle; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -475,2 +485,3 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -502,5 +513,7 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -511,2 +524,3 @@ var position = anchor.getPosition(); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -516,2 +530,3 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -546,2 +561,3 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -554,4 +570,6 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
if (!Object.prototype.hasOwnProperty.call(this, property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -561,2 +579,3 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -563,0 +582,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){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.addListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addListener(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.addListener(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)Object.prototype.hasOwnProperty.call(t,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)Object.prototype.hasOwnProperty.call(this,i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();exports.InfoBox=t; | ||
//# sourceMappingURL=cjs.min.js.map |
@@ -71,2 +71,3 @@ var InfoBox = /** @class */ (function () { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -108,7 +109,7 @@ var panes = this.getPanes(); | ||
for (var i = 0; i < events.length; i++) { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, events[i], cancelHandler)); | ||
this.eventListeners.push(google.maps.event.addListener(this.div, events[i], cancelHandler)); | ||
} | ||
// Workaround for Google bug that causes the cursor to change to a pointer | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
this.eventListeners.push(google.maps.event.addListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -119,3 +120,3 @@ _this.div.style.cursor = 'default'; | ||
} | ||
this.contextListener = google.maps.event.addDomListener(this.div, 'contextmenu', ignoreHandler); | ||
this.contextListener = google.maps.event.addListener(this.div, 'contextmenu', ignoreHandler); | ||
/** | ||
@@ -147,3 +148,3 @@ * This event is fired when the DIV containing the InfoBox's content is attached to the DOM. | ||
var closeBox = this.div.firstChild; | ||
this.closeListener = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler()); | ||
this.closeListener = google.maps.event.addListener(closeBox, 'click', this.getCloseClickHandler()); | ||
} | ||
@@ -173,2 +174,3 @@ else { | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -187,4 +189,6 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -198,2 +202,3 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -242,3 +247,4 @@ var projection = this.getProjection(); | ||
for (var i in boxStyle) { | ||
if (boxStyle.hasOwnProperty(i)) { | ||
if (Object.prototype.hasOwnProperty.call(boxStyle, i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -255,2 +261,3 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -291,5 +298,7 @@ this.div.style.msFilter = | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -316,2 +325,3 @@ var currentStyle = this.div.currentStyle; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -471,2 +481,3 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -498,5 +509,7 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -507,2 +520,3 @@ var position = anchor.getPosition(); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -512,2 +526,3 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -542,2 +557,3 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -550,4 +566,6 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
if (!Object.prototype.hasOwnProperty.call(this, property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -557,2 +575,3 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -559,0 +578,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){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.addListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addListener(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.addListener(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)Object.prototype.hasOwnProperty.call(t,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)Object.prototype.hasOwnProperty.call(this,i)||(this.prototype[i]=t.prototype[i]);return this}.apply(t,[i])},t}();export{t as InfoBox}; | ||
//# sourceMappingURL=esm.min.js.map |
@@ -77,2 +77,3 @@ (function (global, factory) { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -114,7 +115,7 @@ var panes = this.getPanes(); | ||
for (var i = 0; i < events.length; i++) { | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, events[i], cancelHandler)); | ||
this.eventListeners.push(google.maps.event.addListener(this.div, events[i], cancelHandler)); | ||
} | ||
// Workaround for Google bug that causes the cursor to change to a pointer | ||
// when the mouse moves over a marker underneath InfoBox. | ||
this.eventListeners.push(google.maps.event.addDomListener(this.div, 'mouseover', function () { | ||
this.eventListeners.push(google.maps.event.addListener(this.div, 'mouseover', function () { | ||
if (_this.div) { | ||
@@ -125,3 +126,3 @@ _this.div.style.cursor = 'default'; | ||
} | ||
this.contextListener = google.maps.event.addDomListener(this.div, 'contextmenu', ignoreHandler); | ||
this.contextListener = google.maps.event.addListener(this.div, 'contextmenu', ignoreHandler); | ||
/** | ||
@@ -153,3 +154,3 @@ * This event is fired when the DIV containing the InfoBox's content is attached to the DOM. | ||
var closeBox = this.div.firstChild; | ||
this.closeListener = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler()); | ||
this.closeListener = google.maps.event.addListener(closeBox, 'click', this.getCloseClickHandler()); | ||
} | ||
@@ -179,2 +180,3 @@ else { | ||
if (this.div && !disablePan) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -193,4 +195,6 @@ var map = this.getMap(); | ||
var mapDiv = map.getDiv(); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
var mapWidth = mapDiv.offsetWidth; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -204,2 +208,3 @@ var mapHeight = mapDiv.offsetHeight; | ||
var padY = this.infoBoxClearance.height; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -248,3 +253,4 @@ var projection = this.getProjection(); | ||
for (var i in boxStyle) { | ||
if (boxStyle.hasOwnProperty(i)) { | ||
if (Object.prototype.hasOwnProperty.call(boxStyle, i)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -261,2 +267,3 @@ this.div.style[i] = boxStyle[i]; | ||
var opacity = parseFloat(this.div.style.opacity || ''); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -297,5 +304,7 @@ this.div.style.msFilter = | ||
else if ( | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
document.documentElement.currentStyle // MSIE | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -322,2 +331,3 @@ var currentStyle = this.div.currentStyle; | ||
if (this.div) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -477,2 +487,3 @@ var projection = this.getProjection(); | ||
InfoBox.prototype.getVisible = function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -504,5 +515,7 @@ var map = this.getMap(); | ||
if (anchor) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
this.position = anchor.getPosition(); | ||
this.moveListener = google.maps.event.addListener(anchor, 'position_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -513,2 +526,3 @@ var position = anchor.getPosition(); | ||
this.mapListener = google.maps.event.addListener(anchor, 'map_changed', function () { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -518,2 +532,3 @@ _this.setMap(anchor.map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -548,2 +563,3 @@ this.setMap(map); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -556,4 +572,6 @@ this.setMap(null); | ||
for (var property in object.prototype) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (!this.prototype.hasOwnProperty(property)) { | ||
if (!Object.prototype.hasOwnProperty.call(this, property)) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -563,2 +581,3 @@ this.prototype[property] = object.prototype[property]; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -565,0 +584,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){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.addListener(this.div,s[o],i));this.eventListeners.push(google.maps.event.addListener(this.div,"mouseover",(function(){t.div&&(t.div.style.cursor="default")})))}this.contextListener=google.maps.event.addListener(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.addListener(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)Object.prototype.hasOwnProperty.call(t,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)Object.prototype.hasOwnProperty.call(this,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.8.0", | ||
"version": "2.10.0", | ||
"description": "InfoBox for React.js Google Maps API", | ||
@@ -52,51 +52,14 @@ "license": "MIT", | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@getify/eslint-plugin-proper-arrows": "11.0.3", | ||
"@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.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", | ||
"eslint-plugin-babel": "5.3.1", | ||
"eslint-plugin-dependencies": "2.4.0", | ||
"eslint-plugin-filenames": "1.3.2", | ||
"eslint-plugin-html": "6.2.0", | ||
"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.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-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.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", | ||
"@rollup/plugin-commonjs": "21.1.0", | ||
"@rollup/plugin-node-resolve": "13.2.1", | ||
"@rollup/plugin-typescript": "8.3.2", | ||
"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.70.1", | ||
"rollup-plugin-dts": "4.2.0", | ||
"rollup-plugin-terser": "7.0.2", | ||
"ts-jest": "27.1.4", | ||
"typescript": "4.6.3" | ||
"rollup": "2.70.2", | ||
"rollup-plugin-dts": "4.2.1", | ||
"rollup-plugin-terser": "7.0.2" | ||
}, | ||
"gitHead": "80167ddcc3d8e356dbf0b0c3a6292c6a3a989f83" | ||
} |
@@ -32,2 +32,2 @@ /* eslint-disable filenames/match-exported */ | ||
export { InfoBoxOptions } from './types' | ||
export { type InfoBoxOptions } from './types' |
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
349448
9
2542