- disable Leaflet’s zoom animation for GMaps Layers. It was wrong
anyway and due to the way Leaflet/GMaps worked, latter only started zooming after former was finished, making zooming very slow. This is an experimental change. Please report if you have problems. - remove superfluous calls in LeafletGoogle
This commit is contained in:
parent
4788e1119e
commit
e0fbff2826
18
external/leaflet_google.js
vendored
18
external/leaflet_google.js
vendored
@ -36,12 +36,11 @@ L.Google = L.Class.extend({
|
|||||||
this._initContainer();
|
this._initContainer();
|
||||||
this._initMapObject();
|
this._initMapObject();
|
||||||
|
|
||||||
// set up events
|
this._map.options.zoomAnimation = false;
|
||||||
map.on('viewreset', this._resetCallback, this);
|
|
||||||
|
|
||||||
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
|
// set up events
|
||||||
|
//~ map.on('viewreset', this._resetCallback, this);
|
||||||
map.on('move', this._update, this);
|
map.on('move', this._update, this);
|
||||||
//map.on('moveend', this._update, this);
|
|
||||||
|
|
||||||
this._reset();
|
this._reset();
|
||||||
this._update();
|
this._update();
|
||||||
@ -51,7 +50,8 @@ L.Google = L.Class.extend({
|
|||||||
this._map._container.removeChild(this._container);
|
this._map._container.removeChild(this._container);
|
||||||
//this._container = null;
|
//this._container = null;
|
||||||
|
|
||||||
this._map.off('viewreset', this._resetCallback, this);
|
//~ this._map.off('viewreset', this._resetCallback, this);
|
||||||
|
this._map.options.zoomAnimation = true;
|
||||||
|
|
||||||
this._map.off('move', this._update, this);
|
this._map.off('move', this._update, this);
|
||||||
//this._map.off('moveend', this._update, this);
|
//this._map.off('moveend', this._update, this);
|
||||||
@ -122,19 +122,11 @@ L.Google = L.Class.extend({
|
|||||||
_update: function() {
|
_update: function() {
|
||||||
this._resize();
|
this._resize();
|
||||||
|
|
||||||
var bounds = this._map.getBounds();
|
|
||||||
var ne = bounds.getNorthEast();
|
|
||||||
var sw = bounds.getSouthWest();
|
|
||||||
var google_bounds = new google.maps.LatLngBounds(
|
|
||||||
new google.maps.LatLng(sw.lat, sw.lng),
|
|
||||||
new google.maps.LatLng(ne.lat, ne.lng)
|
|
||||||
);
|
|
||||||
var center = this._map.getCenter();
|
var center = this._map.getCenter();
|
||||||
var _center = new google.maps.LatLng(center.lat, center.lng);
|
var _center = new google.maps.LatLng(center.lat, center.lng);
|
||||||
|
|
||||||
this._google.setCenter(_center);
|
this._google.setCenter(_center);
|
||||||
this._google.setZoom(this._map.getZoom());
|
this._google.setZoom(this._map.getZoom());
|
||||||
//this._google.fitBounds(google_bounds);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_resize: function() {
|
_resize: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user