mirror of
https://github.com/RustyRaptor/react-leaflet-google.git
synced 2026-12-03 23:45:17 -07:00
1 line
8.0 KiB
JavaScript
1 line
8.0 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-leaflet")):"function"==typeof define&&define.amd?define(["react","react-leaflet"],t):"object"==typeof exports?exports.ReactLeaflet=t(require("react"),require("react-leaflet")):e.ReactLeaflet=t(e.React,e[void 0])}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleLayer=void 0;var i=o(1),r=n(i);t.GoogleLayer=r["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var o={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),c=function f(e,t,o){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var i=Object.getPrototypeOf(e);return null===i?void 0:f(i,t,o)}if("value"in n)return n.value;var r=n.get;if(void 0!==r)return r.call(o)},u=o(4),p=(n(u),o(5)),d=(o(2),function(e){function t(){return r(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return l(t,e),s(t,[{key:"componentWillMount",value:function(){c(Object.getPrototypeOf(t.prototype),"componentWillMount",this).call(this);var e=this.props,o=(e.map,e.layerContainer,e.googlekey),n=e.type,r=e.asclientid,a=i(e,["map","layerContainer","googlekey","type","asclientid"]);this.leafletElement=new L.Google(o,n,r,a)}}]),t}(p.BaseTileLayer));d.propTypes={type:u.PropTypes.string,googlekey:u.PropTypes.string.isRequired,asclientid:u.PropTypes.bool},t["default"]=d},function(e,t,o){"use strict";var n=o(3);n.VERSION="3.14";var i=null;L.Google=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,continuousWorld:!1,noWrap:!1,mapOptions:{backgroundColor:"#dddddd"}},initialize:function(e,t,o,r){L.Util.setOptions(this,r);var a=this;o?n.CLIENT=e:n.KEY=e,n.onLoad(function(){a._ready=!0}),n.load(function(e){i=e,console.log("I just loaded google maps api"),a._initMapObject(),a._update()}),a._type=t||"SATELLITE"},onAdd:function(e,t){this._map=e,this._insertAtTheBottom=t,this._initContainer(),this._initMapObject(),e.on("viewreset",this._reset,this),this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),e.on("move",this._update,this),e.on("zoomanim",this._handleZoomAnim,this),e._controlCorners.bottomright.style.marginBottom="20px",this._reset(),this._update()},onRemove:function(e){e._container.removeChild(this._container),e.off("viewreset",this._reset,this),e.off("move",this._update,this),e.off("zoomanim",this._handleZoomAnim,this),e._controlCorners.bottomright.style.marginBottom="0em"},getAttribution:function(){return this.options.attribution},setOpacity:function(e){this.options.opacity=e,1>e&&L.DomUtil.setOpacity(this._container,e)},setElementSize:function(e,t){e.style.width=t.x+"px",e.style.height=t.y+"px"},_initContainer:function(){var e=this._map._container,t=e.firstChild;this._container||(this._container=L.DomUtil.create("div","leaflet-google-layer leaflet-top leaflet-left"),this._container.id="_GMapContainer_"+L.Util.stamp(this),this._container.style.zIndex="auto"),e.insertBefore(this._container,t),this.setOpacity(this.options.opacity),this.setElementSize(this._container,this._map.getSize())},_initMapObject:function(){if(this._ready){this._google_center=new i.maps.LatLng(0,0);var e=new i.maps.Map(this._container,{center:this._google_center,zoom:0,tilt:0,mapTypeId:i.maps.MapTypeId[this._type],disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1,styles:this.options.mapOptions.styles,backgroundColor:this.options.mapOptions.backgroundColor}),t=this;this._reposition=i.maps.event.addListenerOnce(e,"center_changed",function(){t.onReposition()}),this._google=e,i.maps.event.addListenerOnce(e,"idle",function(){t._checkZoomLevels()}),i.maps.event.addListenerOnce(e,"tilesloaded",function(){t.fire("load")}),this.fire("MapObjectInitialized",{mapObject:e})}},_checkZoomLevels:function(){void 0!==this._map.getZoom()&&this._google.getZoom()!==this._map.getZoom()&&this._map.setZoom(this._google.getZoom())},_reset:function(){this._initContainer()},_update:function(){if(this._google){this._resize();var e=this._map.getCenter(),t=new i.maps.LatLng(e.lat,e.lng);this._google.setCenter(t),void 0!==this._map.getZoom()&&this._google.setZoom(Math.round(this._map.getZoom())),this._checkZoomLevels()}},_resize:function(){var e=this._map.getSize();this._container.style.width===e.x&&this._container.style.height===e.y||(this.setElementSize(this._container,e),this.onReposition())},_handleZoomAnim:function(e){var t=e.center,o=new i.maps.LatLng(t.lat,t.lng);this._google.setCenter(o),this._google.setZoom(Math.round(e.zoom))},onReposition:function(){this._google&&i.maps.event.trigger(this._google,"resize")}}),L.Google.asyncWait=[],L.Google.asyncInitialize=function(){var e;for(e=0;e<L.Google.asyncWait.length;e++){var t=L.Google.asyncWait[e];t._ready=!0,t._container&&(t._initMapObject(),t._update())}L.Google.asyncWait=[]}},function(e,t,o){var n,i;!function(r,a){if(null===r)throw new Error("Google-maps package can be used only in browser");n=a,i="function"==typeof n?n.call(t,o,t,e):n,!(void 0!==i&&(e.exports=i))}("undefined"!=typeof window?window:null,function(){"use strict";var e="3.18",t=null,o=null,n=!1,i=[],r=[],a=null,l={};l.URL="https://maps.googleapis.com/maps/api/js",l.KEY=null,l.LIBRARIES=[],l.CLIENT=null,l.CHANNEL=null,l.LANGUAGE=null,l.REGION=null,l.VERSION=e,l.WINDOW_CALLBACK_NAME="__google_maps_api_provider_initializator__",l._googleMockApiObject={},l.load=function(e){null===o?n===!0?e&&i.push(e):(n=!0,window[l.WINDOW_CALLBACK_NAME]=function(){s(e)},l.createLoader()):e&&e(o)},l.createLoader=function(){t=document.createElement("script"),t.type="text/javascript",t.src=l.createUrl(),document.body.appendChild(t)},l.isLoaded=function(){return null!==o},l.createUrl=function(){var e=l.URL;return e+="?callback="+l.WINDOW_CALLBACK_NAME,l.KEY&&(e+="&key="+l.KEY),l.LIBRARIES.length>0&&(e+="&libraries="+l.LIBRARIES.join(",")),l.CLIENT&&(e+="&client="+l.CLIENT+"&v="+l.VERSION),l.CHANNEL&&(e+="&channel="+l.CHANNEL),l.LANGUAGE&&(e+="&language="+l.LANGUAGE),l.REGION&&(e+="®ion="+l.REGION),e},l.release=function(s){var c=function(){l.KEY=null,l.LIBRARIES=[],l.CLIENT=null,l.CHANNEL=null,l.LANGUAGE=null,l.REGION=null,l.VERSION=e,o=null,n=!1,i=[],r=[],"undefined"!=typeof window.google&&delete window.google,"undefined"!=typeof window[l.WINDOW_CALLBACK_NAME]&&delete window[l.WINDOW_CALLBACK_NAME],null!==a&&(l.createLoader=a,a=null),null!==t&&(t.parentElement.removeChild(t),t=null),s&&s()};n?l.load(function(){c()}):c()},l.onLoad=function(e){r.push(e)},l.makeMock=function(){a=l.createLoader,l.createLoader=function(){window.google=l._googleMockApiObject,window[l.WINDOW_CALLBACK_NAME]()}};var s=function(e){var t;for(n=!1,null===o&&(o=window.google),t=0;t<r.length;t++)r[t](o);for(e&&e(o),t=0;t<i.length;t++)i[t](o);i=[]};return l})},function(t,o){t.exports=e},function(e,o){e.exports=t}])}); |