Skip to content

Commit 3d73ebb

Browse files
author
David Disch
committed
Use _getTransformForUpdate for changes to min zoom and max zoom as it may apply changes to zoom
1 parent d16956f commit 3d73ebb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ui/map.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,9 @@ export class Map extends Camera {
11441144
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
11451145

11461146
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
1147-
this.transform.setMinZoom(minZoom);
1147+
const tr = this._getTransformForUpdate();
1148+
tr.setMinZoom(minZoom);
1149+
this._applyUpdatedTransform(tr);
11481150
this._update();
11491151

11501152
if (this.getZoom() < minZoom) this.setZoom(minZoom);
@@ -1184,7 +1186,9 @@ export class Map extends Camera {
11841186
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
11851187

11861188
if (maxZoom >= this.transform.minZoom) {
1187-
this.transform.setMaxZoom(maxZoom);
1189+
const tr = this._getTransformForUpdate();
1190+
tr.setMaxZoom(maxZoom);
1191+
this._applyUpdatedTransform(tr);
11881192
this._update();
11891193

11901194
if (this.getZoom() > maxZoom) this.setZoom(maxZoom);

0 commit comments

Comments
 (0)