fix(#2391): split zoomTo to accept bounds (#2394)
Some checks failed
Test & Docs / tests (postgresql, 3.10) (push) Has been cancelled
Test & Docs / tests (postgresql, 3.12) (push) Has been cancelled
Test & Docs / lint (push) Has been cancelled
Test & Docs / docs (push) Has been cancelled

Since
de921660c9 (diff-4a01a166046bdf7e4ea7d41d97cd82a57c82f63d10d1697f76e6fe22bfa769ebR954)
we were calling it with bounds but also with the click event sometimes.
This commit is contained in:
David Larlet 2024-12-20 09:42:46 -05:00 committed by GitHub
commit 49d1dbf36e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -950,9 +950,13 @@ export class DataLayer extends ServerStored {
else this.hide()
}
zoomTo(bounds) {
zoomTo() {
if (!this.isVisible()) return
bounds = bounds || this.layer.getBounds()
const bounds = this.layer.getBounds()
this.zoomToBounds(bounds)
}
zoomToBounds(bounds) {
if (bounds.isValid()) {
const options = { maxZoom: this.getOption('zoomTo') }
this._leafletMap.fitBounds(bounds, options)

View file

@ -382,7 +382,7 @@ export default class Importer extends Utils.WithTemplate {
bounds.extend(featureBounds)
}
this.onSuccess(features.length)
layer.zoomTo(bounds)
layer.zoomToBounds(bounds)
}
}
}