mirror of
https://github.com/RustyRaptor/react-leaflet-google.git
synced 2026-12-03 23:45:17 -07:00
[#master] Including onAfterLoad listener to plug native google features when loaded
This commit is contained in:
1 parent
d8348f946b
commit
77df0bbf0d
3 files changed
+9
-1
No files matched your search
Vendored
+4
@@ -218,6 +218,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
self._initMutant();
|
||||
self._update();
|
||||
|
||||
if (options.onAfterLoad) {
|
||||
options.onAfterLoad(google);
|
||||
}
|
||||
|
||||
//this._ready = google.maps.Map !== undefined;
|
||||
//if (!this._ready) L.Google.asyncWait.push(this);
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-leaflet")):"function"==typeof define&&define.amd?define(["react","react-leaflet"],e):"object"==typeof exports?exports.ReactLeaflet=e(require("react"),require("react-leaflet")):t.ReactLeaflet=e(t.React,t[void 0])}(this,function(t,e){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleLayer=void 0;var o=i(1),r=n(o);e.GoogleLayer=r.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var i={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,i,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},h=i(4),p=(n(h),i(5)),c=(i(2),function(t){function e(){return r(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),l(e,[{key:"componentWillMount",value:function(){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"componentWillMount",this).call(this);var t=this.props;t.map,t.googlekey,t.maptype,t.asclientid,o(t,["map","googlekey","maptype","asclientid"]);this.leafletElement=new L.gridLayer.googleMutant(this.props)}},{key:"componentDidUpdate",value:function(t){var e=this.props,i=e.opacity,n=e.zIndex;i!==t.opacity&&this.leafletElement.setOpacity(i),n!==t.zIndex&&this.leafletElement.setZIndex(n)}}]),e}(p.GridLayer));c.propTypes={googlekey:h.PropTypes.string.isRequired,maptype:h.PropTypes.string,asclientid:h.PropTypes.bool},e.default=c},function(t,e,i){"use strict";var n=i(3);n.VERSION="3.18",L.GridLayer.GoogleMutant=L.GridLayer.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,continuousWorld:!1,noWrap:!1,type:"satellite",maxNativeZoom:21},initialize:function(t){L.GridLayer.prototype.initialize.call(this,t);var e=this;t.asclientid?n.CLIENT=t.googlekey:n.KEY=t.googlekey,n.LIBRARIES=t.libraries||[],e._type=t.maptype||"SATELLITE",n.load(function(t){google=t,console.log("I just loaded google maps api"),e._ready=!0,e._initMutant(),e._update()}),this._tileCallbacks={},this._freshTiles={},this._imagesPerTile="hybrid"===e._type?2:1,this.createTile="hybrid"===e._type?this._createMultiTile:this._createSingleTile},onAdd:function(t){L.GridLayer.prototype.onAdd.call(this,t),this._initMutantContainer(),this._ready&&(this._map=t,this._initMutant(),t.on("viewreset",this._reset,this),t.on("move",this._update,this),t.on("zoomend",this._handleZoomAnim,this),t.on("resize",this._resize,this),t._controlCorners.bottomright.style.marginBottom="20px",this._reset(),this._update())},onRemove:function(t){L.GridLayer.prototype.onRemove.call(this,t),t._container.removeChild(this._mutantContainer),this._mutantContainer=void 0,t.off("viewreset",this._reset,this),t.off("move",this._update,this),t.off("zoomend",this._handleZoomAnim,this),t.off("resize",this._resize,this),t._controlCorners.bottomright.style.marginBottom="0em"},getAttribution:function(){return this.options.attribution},setOpacity:function(t){this.options.opacity=t,t<1&&L.DomUtil.setOpacity(this._mutantContainer,t)},setElementSize:function(t,e){t.style.width=e.x+"px",t.style.height=e.y+"px"},_initMutantContainer:function(){this._mutantContainer||(this._mutantContainer=L.DomUtil.create("div","leaflet-google-mutant leaflet-top leaflet-left"),this._mutantContainer.id="_MutantContainer_"+L.Util.stamp(this._mutantContainer),this._mutantContainer.style.pointerEvents="none",this._map.getContainer().appendChild(this._mutantContainer)),this.setOpacity(this.options.opacity),this.setElementSize(this._mutantContainer,this._map.getSize()Line truncated
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-leaflet")):"function"==typeof define&&define.amd?define(["react","react-leaflet"],e):"object"==typeof exports?exports.ReactLeaflet=e(require("react"),require("react-leaflet")):t.ReactLeaflet=e(t.React,t[void 0])}(this,function(t,e){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleLayer=void 0;var o=i(1),r=n(o);e.GoogleLayer=r.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var i={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,i,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},h=i(4),p=(n(h),i(5)),c=(i(2),function(t){function e(){return r(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),l(e,[{key:"componentWillMount",value:function(){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"componentWillMount",this).call(this);var t=this.props;t.map,t.googlekey,t.maptype,t.asclientid,o(t,["map","googlekey","maptype","asclientid"]);this.leafletElement=new L.gridLayer.googleMutant(this.props)}},{key:"componentDidUpdate",value:function(t){var e=this.props,i=e.opacity,n=e.zIndex;i!==t.opacity&&this.leafletElement.setOpacity(i),n!==t.zIndex&&this.leafletElement.setZIndex(n)}}]),e}(p.GridLayer));c.propTypes={googlekey:h.PropTypes.string.isRequired,maptype:h.PropTypes.string,asclientid:h.PropTypes.bool},e.default=c},function(t,e,i){"use strict";var n=i(3);n.VERSION="3.18",L.GridLayer.GoogleMutant=L.GridLayer.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,continuousWorld:!1,noWrap:!1,type:"satellite",maxNativeZoom:21},initialize:function(t){L.GridLayer.prototype.initialize.call(this,t);var e=this;t.asclientid?n.CLIENT=t.googlekey:n.KEY=t.googlekey,n.LIBRARIES=t.libraries||[],e._type=t.maptype||"SATELLITE",n.load(function(i){google=i,console.log("I just loaded google maps api"),e._ready=!0,e._initMutant(),e._update(),t.onAfterLoad&&t.onAfterLoad(google)}),this._tileCallbacks={},this._freshTiles={},this._imagesPerTile="hybrid"===e._type?2:1,this.createTile="hybrid"===e._type?this._createMultiTile:this._createSingleTile},onAdd:function(t){L.GridLayer.prototype.onAdd.call(this,t),this._initMutantContainer(),this._ready&&(this._map=t,this._initMutant(),t.on("viewreset",this._reset,this),t.on("move",this._update,this),t.on("zoomend",this._handleZoomAnim,this),t.on("resize",this._resize,this),t._controlCorners.bottomright.style.marginBottom="20px",this._reset(),this._update())},onRemove:function(t){L.GridLayer.prototype.onRemove.call(this,t),t._container.removeChild(this._mutantContainer),this._mutantContainer=void 0,t.off("viewreset",this._reset,this),t.off("move",this._update,this),t.off("zoomend",this._handleZoomAnim,this),t.off("resize",this._resize,this),t._controlCorners.bottomright.style.marginBottom="0em"},getAttribution:function(){return this.options.attribution},setOpacity:function(t){this.options.opacity=t,t<1&&L.DomUtil.setOpacity(this._mutantContainer,t)},setElementSize:function(t,e){t.style.width=e.x+"px",t.style.height=e.y+"px"},_initMutantContainer:function(){this._mutantContainer||(this._mutantContainer=L.DomUtil.create("div","leaflet-google-mutant leaflet-top leaflet-left"),this._mutantContainer.id="_MutantContainer_"+L.Util.stamp(this._mutantContainer),this._mutantContainer.style.pointerEvents="none",this._map.getContainer().appendChild(this._mutantContainer)),this.setOpacity(this.options.opacity),this.setElementSize(thisLine truncated
|
||||
@@ -48,6 +48,10 @@ L.GridLayer.GoogleMutant = L.GridLayer.extend({
|
||||
self._initMutant();
|
||||
self._update();
|
||||
|
||||
if (options.onAfterLoad) {
|
||||
options.onAfterLoad(google);
|
||||
}
|
||||
|
||||
//this._ready = google.maps.Map !== undefined;
|
||||
//if (!this._ready) L.Google.asyncWait.push(this);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user