Skip to content

Commit

Permalink
Add possibility to update fixed zoom and center
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaZhidovKarelics committed Dec 8, 2023
1 parent 2b88fef commit 59c8c59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/Control.MiniMap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/Control.MiniMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@
this._miniMap.addLayer(this._layer);
},

setFixedZoomLevel(zoomLevel) {
this.options.zoomLevelFixed = zoomLevel;
this._decideZoom(true);
},

setFixedCenter(center) {
this.options.centerFixed = center;
this._miniMap.setView(center, this._decideZoom(true));
},

_addToggleButton: function () {
this._toggleDisplayButton = this.options.toggleDisplay ? this._createButton(
'', this._toggleButtonInitialTitleText(), ('leaflet-control-minimap-toggle-display leaflet-control-minimap-toggle-display-' +
Expand Down Expand Up @@ -262,6 +272,8 @@
},

_onMiniMapMoved: function (e) {
if (this.options.centerFixed) return;

if (!this._mainMapMoving) {
this._miniMapMoving = true;
this._mainMap.setView(this._miniMap.getCenter(), this._decideZoom(false));
Expand Down

0 comments on commit 59c8c59

Please sign in to comment.