Skip to content

Commit

Permalink
Handle user defined map zoom options
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaZhidovKarelics committed Dec 1, 2023
1 parent 69be6dd commit 2b88fef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
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.

19 changes: 15 additions & 4 deletions src/Control.MiniMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,28 @@
L.DomEvent.disableClickPropagation(this._container);
L.DomEvent.on(this._container, 'mousewheel', L.DomEvent.stopPropagation);

var touchZoom = this.options.mapOptions.touchZoom;
var scrollWheelZoom = this.options.mapOptions.scrollWheelZoom;
var doubleClickZoom = this.options.mapOptions.doubleClickZoom;

var mapOptions = {
attributionControl: false,
dragging: !this.options.centerFixed,
zoomControl: false,
zoomAnimation: this.options.zoomAnimation,
autoToggleDisplay: this.options.autoToggleDisplay,
touchZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
scrollWheelZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
doubleClickZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
touchZoom: this._isDefined(touchZoom)
? touchZoom
: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
scrollWheelZoom: this._isDefined(scrollWheelZoom)
? scrollWheelZoom
: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
doubleClickZoom: this._isDefined(doubleClickZoom)
? doubleClickZoom
: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
boxZoom: !this._isZoomLevelFixed(),
crs: map.options.crs
crs: map.options.crs,
...this.options.mapOptions,
};
mapOptions = L.Util.extend(this.options.mapOptions, mapOptions); // merge with priority of the local mapOptions object.

Expand Down

0 comments on commit 2b88fef

Please sign in to comment.