Skip to content

Commit 9bc8306

Browse files
committed
Merge pull request #57 from SiggyF/fedor-events
Set view center and zoom later so we can capture load event
2 parents adc6f79 + df6c273 commit 9bc8306

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

leaflet-core.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,6 @@
655655
domReady: function() {
656656
this.guessLeafletImagePath();
657657
var map = L.map(this.$.map, {
658-
center: [this.latitude, this.longitude],
659-
zoom: this.zoom,
660658
minZoom: this.minZoom,
661659
maxZoom: this.maxZoom,
662660
dragging: !this.noDragging,
@@ -681,7 +679,7 @@
681679
zoomAnimationThreshold: this.zoomAnimationThreshold
682680
});
683681
this.map = map;
684-
682+
685683
// fire an event for when this.map is defined and ready.
686684
// (needed for components that talk to this.map directly)
687685
this.fire('map-ready');
@@ -690,7 +688,8 @@
690688
map.on('click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu focus blur preclick load unload viewreset movestart move moveend dragstart drag dragend zoomstart zoomend zoomlevelschange resize autopanstart layeradd layerremove baselayerchange overlayadd overlayremove locationfound locationerror popupopen popupclose', function(e) {
691689
this.fire(e.type, e);
692690
}, this);
693-
691+
// set map view after registering events so viewreset and load events can be caught
692+
map.setView([this.latitude, this.longitude], this.zoom);
694693
// update attributes
695694
map.on('moveend', function(e) {
696695
this._ignoreViewChange = true;

0 commit comments

Comments
 (0)