fix: do not fail when navigating with popup arrows in cluster mode (#2307)
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

- make sure we have correct `this` in callback
- do not call anymatePan if icon is not added to map (because
clusterized)
This commit is contained in:
Yohan Boniface 2024-11-29 21:43:52 +01:00 committed by GitHub
commit e33fc787ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -44,7 +44,8 @@ const Popup = BasePopup.extend({
DomEvent.on(el, 'load', () => { DomEvent.on(el, 'load', () => {
this._updateLayout() this._updateLayout()
this._updatePosition() this._updatePosition()
this._adjustPan() // Do not call when feature is in cluster.
if (this._map) this._adjustPan()
}) })
}, },
}) })

View file

@ -60,7 +60,7 @@ class PopupTemplate {
feature: nextFeature.properties.name || translate('next'), feature: nextFeature.properties.name || translate('next'),
}) })
DomEvent.on(next, 'click', () => { DomEvent.on(next, 'click', () => {
nextFeature.zoomTo({ callback: nextFeature.view }) nextFeature.zoomTo({ callback: (event) => nextFeature.view(event) })
}) })
} }
if (previousFeature) { if (previousFeature) {
@ -68,7 +68,7 @@ class PopupTemplate {
feature: previousFeature.properties.name || translate('previous'), feature: previousFeature.properties.name || translate('previous'),
}) })
DomEvent.on(previous, 'click', () => { DomEvent.on(previous, 'click', () => {
previousFeature.zoomTo({ callback: previousFeature.view }) previousFeature.zoomTo({ callback: (event) => previousFeature.view(event) })
}) })
} }
DomEvent.on(zoom, 'click', () => feature.zoomTo()) DomEvent.on(zoom, 'click', () => feature.zoomTo())