Skip to content

Commit

Permalink
Fixed cluster regression. Geezes fuck leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Dec 28, 2019
1 parent 1edbc97 commit 269b51e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ different releases and which versions of PHP and MediaWiki they support, see the
## Maps 7.15.4

* Dark Leaflet layers are no longer shown (7.10.0 revert)
* Fixed recent Leaflet cluster regression

## Maps 7.15.3

Expand Down
36 changes: 23 additions & 13 deletions resources/leaflet/jquery.leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,38 @@
_this.options = options; // needed by LeafletAjax.js

this.setup = function() {
this.doSetup();
};

this.doSetup = function() {
this.map = L.map( this.get(0), getMapOptions(options) );
this.mapContent = maps.leaflet.FeatureBuilder.contentLayerFromOptions(options);

this.ranSetup = false;

this.mapContent.on('add', function(e) {
_this.centerAndZoomMap();
_this.doSetup();
});

this.mapContent.addTo(this.map);
this.map.fitWorld();

this.hideLoadingMessage();
this.addZoomControl();
this.addLayersAndOverlays();
this.bindClickTarget();
this.applyResizable();
this.bindAjaxEvents();
// For whatever reason the add event does not fire when using marker cluster, hence this fallback.
setTimeout(function() {
_this.doSetup();
},250);
};

this.doSetup = function() {
if (!this.ranSetup) {
this.ranSetup = true;

this.maybeAddEditButton();
this.hideLoadingMessage();
this.addZoomControl();
this.addLayersAndOverlays();
this.map.fitWorld();
this.centerAndZoomMap();
this.bindClickTarget();
this.applyResizable();
this.bindAjaxEvents();

this.maybeAddEditButton();
}
};

this.addZoomControl = function() {
Expand Down

0 comments on commit 269b51e

Please sign in to comment.