bug fixed issues#1

This commit is contained in:
Christos committed 2016-12-28 20:29:00 +02:00
1 parent a65180a943
commit 0af5d10fb9
4 files changed
+179 -170

No files matched your search

+2 -2
View File
@@ -107,13 +107,13 @@ return /******/ (function(modules) { // webpackBootstrap
function GoogleLayer() {
_classCallCheck(this, GoogleLayer);
return _possibleConstructorReturn(this, (GoogleLayer.__proto__ || Object.getPrototypeOf(GoogleLayer)).apply(this, arguments));
return _possibleConstructorReturn(this, Object.getPrototypeOf(GoogleLayer).apply(this, arguments));
}
_createClass(GoogleLayer, [{
key: 'componentWillMount',
value: function componentWillMount() {
_get(GoogleLayer.prototype.__proto__ || Object.getPrototypeOf(GoogleLayer.prototype), 'componentWillMount', this).call(this);
_get(Object.getPrototypeOf(GoogleLayer.prototype), 'componentWillMount', this).call(this);
var _props = this.props;
var _map = _props.map;
var _lc = _props.layerContainer;
+1 -1
View File
@@ -1 +1 @@
!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,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return l(t,e),s(t,[{key:"componentWillMount",value:function(){c(t.prototype.__proto__||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,e<1&&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.mapsLine truncated
!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",functiLine truncated
+2 -2
View File
@@ -32,13 +32,13 @@ var GoogleLayer = function (_BaseTileLayer) {
function GoogleLayer() {
_classCallCheck(this, GoogleLayer);
return _possibleConstructorReturn(this, (GoogleLayer.__proto__ || Object.getPrototypeOf(GoogleLayer)).apply(this, arguments));
return _possibleConstructorReturn(this, Object.getPrototypeOf(GoogleLayer).apply(this, arguments));
}
_createClass(GoogleLayer, [{
key: 'componentWillMount',
value: function componentWillMount() {
_get(GoogleLayer.prototype.__proto__ || Object.getPrototypeOf(GoogleLayer.prototype), 'componentWillMount', this).call(this);
_get(Object.getPrototypeOf(GoogleLayer.prototype), 'componentWillMount', this).call(this);
var _props = this.props;
var _map = _props.map;
var _lc = _props.layerContainer;
+174 -165
View File
@@ -5,218 +5,227 @@
/* global google: true */
var GoogleMapsLoader = require('google-maps');
GoogleMapsLoader.VERSION = '3.14';
GoogleMapsLoader.VERSION = '3.25';
var google = null;
L.Google = L.Class.extend({
includes: L.Mixin.Events,
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
mapOptions: {
backgroundColor: '#dddddd'
}
},
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
mapOptions: {
backgroundColor: '#dddddd'
}
},
// Possible types: SATELLITE, ROADMAP, HYBRID, TERRAIN
initialize: function (goolekey, type, asclientid, options) {
L.Util.setOptions(this, options);
var self = this;
// Possible types: SATELLITE, ROADMAP, HYBRID, TERRAIN
initialize: function (goolekey, type, asclientid, options) {
L.Util.setOptions(this, options);
var self = this;
if (asclientid) {
GoogleMapsLoader.CLIENT = goolekey;
} else {
GoogleMapsLoader.KEY = goolekey;
}
if (asclientid) {
GoogleMapsLoader.CLIENT = goolekey;
} else {
GoogleMapsLoader.KEY = goolekey;
}
GoogleMapsLoader.onLoad(function () {
self._ready = true;
});
GoogleMapsLoader.load(function (_google) {
google = _google;
console.log('I just loaded google maps api');
GoogleMapsLoader.onLoad(function () {
self._ready = true;
});
GoogleMapsLoader.load(function (_google) {
google = _google;
console.log('I just loaded google maps api');
self._ready = true;
self._initMapObject();
self._update();
self._initMapObject();
self._update();
//this._ready = google.maps.Map !== undefined;
//if (!this._ready) L.Google.asyncWait.push(this);
});
self._type = type || 'SATELLITE';
},
//this._ready = google.maps.Map !== undefined;
//if (!this._ready) L.Google.asyncWait.push(this);
});
self._type = type || 'SATELLITE';
},
onAdd: function (map, insertAtTheBottom) {
this._map = map;
this._insertAtTheBottom = insertAtTheBottom;
onAdd: function (map, insertAtTheBottom) {
this._map = map;
this._insertAtTheBottom = insertAtTheBottom;
// create a container div for tiles
this._initContainer();
this._initMapObject();
// create a container div for tiles
this._initContainer();
this._initMapObject();
// set up events
map.on('viewreset', this._reset, this);
// set up events
map.on('viewreset', this._reset, this);
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
map.on('move', this._update, this);
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
map.on('move', this._update, this);
map.on('zoomanim', this._handleZoomAnim, this);
map.on('zoomanim', this._handleZoomAnim, this);
//20px instead of 1em to avoid a slight overlap with google's attribution
map._controlCorners.bottomright.style.marginBottom = '20px';
//20px instead of 1em to avoid a slight overlap with google's attribution
map._controlCorners.bottomright.style.marginBottom = '20px';
this._reset();
this._update();
},
this._reset();
this._update();
},
onRemove: function (map) {
map._container.removeChild(this._container);
onRemove: function (map) {
map._container.removeChild(this._container);
map.off('viewreset', this._reset, this);
map.off('viewreset', this._reset, this);
map.off('move', this._update, this);
map.off('move', this._update, this);
map.off('zoomanim', this._handleZoomAnim, this);
map.off('zoomanim', this._handleZoomAnim, this);
map._controlCorners.bottomright.style.marginBottom = '0em';
},
map._controlCorners.bottomright.style.marginBottom = '0em';
},
getAttribution: function () {
return this.options.attribution;
},
getAttribution: function () {
return this.options.attribution;
},
setOpacity: function (opacity) {
this.options.opacity = opacity;
if (opacity < 1) {
L.DomUtil.setOpacity(this._container, opacity);
}
},
setOpacity: function (opacity) {
this.options.opacity = opacity;
if (opacity < 1) {
L.DomUtil.setOpacity(this._container, opacity);
}
},
setElementSize: function (e, size) {
e.style.width = size.x + 'px';
e.style.height = size.y + 'px';
},
setElementSize: function (e, size) {
e.style.width = size.x + 'px';
e.style.height = size.y + 'px';
},
_initContainer: function () {
var tilePane = this._map._container,
first = tilePane.firstChild;
_initContainer: function () {
var tilePane = this._map._container,
first = tilePane.firstChild;
if (!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';
}
if (!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';
}
tilePane.insertBefore(this._container, first);
tilePane.insertBefore(this._container, first);
this.setOpacity(this.options.opacity);
this.setElementSize(this._container, this._map.getSize());
},
this.setOpacity(this.options.opacity);
this.setElementSize(this._container, this._map.getSize());
},
_initMapObject: function () {
if (!this._ready || !this._container) return;
this._google_center = new google.maps.LatLng(0, 0);
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
tilt: 0,
mapTypeId: google.maps.MapTypeId[this._type],
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
scrollwheel: false,
streetViewControl: false,
styles: this.options.mapOptions.styles,
backgroundColor: this.options.mapOptions.backgroundColor
});
_initMapObject: function () {
if (!this._ready) return;
this._google_center = new google.maps.LatLng(0, 0);
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
tilt: 0,
mapTypeId: google.maps.MapTypeId[this._type],
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
scrollwheel: false,
streetViewControl: false,
styles: this.options.mapOptions.styles,
backgroundColor: this.options.mapOptions.backgroundColor
});
var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, 'center_changed',
function () {
_this.onReposition();
});
this._google = map;
var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, 'center_changed',
function () { _this.onReposition(); });
this._google = map;
google.maps.event.addListenerOnce(map, 'idle',
function () {
_this._checkZoomLevels();
});
google.maps.event.addListenerOnce(map, 'tilesloaded',
function () {
_this.fire('load');
});
//Reporting that map-object was initialized.
this.fire('MapObjectInitialized', {
mapObject: map
});
},
google.maps.event.addListenerOnce(map, 'idle',
function () { _this._checkZoomLevels(); });
google.maps.event.addListenerOnce(map, 'tilesloaded',
function () { _this.fire('load'); });
//Reporting that map-object was initialized.
this.fire('MapObjectInitialized', { mapObject: map });
},
_checkZoomLevels: function () {
//setting the zoom level on the Google map may result in a different zoom level than the one requested
//(it won't go beyond the level for which they have data).
// verify and make sure the zoom levels on both Leaflet and Google maps are consistent
if ((this._map.getZoom() !== undefined) && (this._google.getZoom() !== this._map.getZoom())) {
//zoom levels are out of sync. Set the leaflet zoom level to match the google one
this._map.setZoom(this._google.getZoom());
}
},
_checkZoomLevels: function () {
//setting the zoom level on the Google map may result in a different zoom level than the one requested
//(it won't go beyond the level for which they have data).
// verify and make sure the zoom levels on both Leaflet and Google maps are consistent
if ((this._map.getZoom() !== undefined) && (this._google.getZoom() !== this._map.getZoom())) {
//zoom levels are out of sync. Set the leaflet zoom level to match the google one
this._map.setZoom(this._google.getZoom());
}
},
_reset: function () {
this._initContainer();
},
_reset: function () {
this._initContainer();
},
_update: function () {
if (!this._google) return;
this._resize();
_update: function () {
if (!this._google) return;
this._resize();
var center = this._map.getCenter();
var _center = new google.maps.LatLng(center.lat, center.lng);
var center = this._map.getCenter();
var _center = new google.maps.LatLng(center.lat, center.lng);
this._google.setCenter(_center);
if (this._map.getZoom() !== undefined)
this._google.setZoom(Math.round(this._map.getZoom()));
this._google.setCenter(_center);
if (this._map.getZoom() !== undefined)
this._google.setZoom(Math.round(this._map.getZoom()));
this._checkZoomLevels();
},
this._checkZoomLevels();
},
_resize: function () {
var size = this._map.getSize();
if (this._container.style.width === size.x &&
this._container.style.height === size.y)
return;
this.setElementSize(this._container, size);
this.onReposition();
},
_resize: function () {
var size = this._map.getSize();
if (this._container.style.width === size.x &&
this._container.style.height === size.y)
return;
this.setElementSize(this._container, size);
this.onReposition();
},
_handleZoomAnim: function (e) {
var center = e.center;
var _center = new google.maps.LatLng(center.lat, center.lng);
_handleZoomAnim: function (e) {
var center = e.center;
var _center = new google.maps.LatLng(center.lat, center.lng);
this._google.setCenter(_center);
this._google.setZoom(Math.round(e.zoom));
},
this._google.setCenter(_center);
this._google.setZoom(Math.round(e.zoom));
},
onReposition: function () {
if (!this._google) return;
google.maps.event.trigger(this._google, 'resize');
}
onReposition: function () {
if (!this._google) return;
google.maps.event.trigger(this._google, 'resize');
}
});
L.Google.asyncWait = [];
L.Google.asyncInitialize = function () {
var i;
for (i = 0; i < L.Google.asyncWait.length; i++) {
var o = L.Google.asyncWait[i];
o._ready = true;
if (o._container) {
o._initMapObject();
o._update();
}
}
L.Google.asyncWait = [];
var i;
for (i = 0; i < L.Google.asyncWait.length; i++) {
var o = L.Google.asyncWait[i];
o._ready = true;
if (o._container) {
o._initMapObject();
o._update();
}
}
L.Google.asyncWait = [];
};