fix: do not fail when navigating with popup arrows in cluster mode

- 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 18:32:14 +01:00
parent 4350f55e67
commit ca127c8c3c
2 changed files with 4 additions and 3 deletions

View file

@ -44,7 +44,8 @@ const Popup = BasePopup.extend({
DomEvent.on(el, 'load', () => {
this._updateLayout()
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'),
})
DomEvent.on(next, 'click', () => {
nextFeature.zoomTo({ callback: nextFeature.view })
nextFeature.zoomTo({ callback: (event) => nextFeature.view(event) })
})
}
if (previousFeature) {
@ -68,7 +68,7 @@ class PopupTemplate {
feature: previousFeature.properties.name || translate('previous'),
})
DomEvent.on(previous, 'click', () => {
previousFeature.zoomTo({ callback: previousFeature.view })
previousFeature.zoomTo({ callback: (event) => previousFeature.view(event) })
})
}
DomEvent.on(zoom, 'click', () => feature.zoomTo())