feat: rerender on relevant config change

This commit is contained in:
ccmdi 2025-11-21 13:59:56 -05:00
parent 6149be3a48
commit 4642648a69
No known key found for this signature in database

View file

@ -113,6 +113,9 @@ export class MapBasesView extends BasesView {
}
protected loadConfig(): void {
const oldCoordinatesProp = this.coordinatesProp;
const oldPolygonProp = this.polygonProp;
this.coordinatesProp = this.config.getAsPropertyId('coordinates');
this.coverProp = this.config.getAsPropertyId('coverImage');
this.polygonProp = this.config.getAsPropertyId('polygonPoints');
@ -139,6 +142,7 @@ export class MapBasesView extends BasesView {
this.center = [0, 0]; // Reset if not configured
}
const oldMarkerType = this.markerType;
const markerTypeVal = this.config.get('markerType');
if (markerTypeVal === 'pins' || markerTypeVal === 'dots') {
this.markerType = markerTypeVal;
@ -156,6 +160,11 @@ export class MapBasesView extends BasesView {
if (oldTileLayer !== this.tileLayer && this.deck) {
this.destroyMap();
}
// If coordinates, polygon property, or marker type changed, force update
if ((oldCoordinatesProp !== this.coordinatesProp || oldPolygonProp !== this.polygonProp || oldMarkerType !== this.markerType) && this.deck) {
this.lastPoints = []; // Clear cache to force update
}
}
protected renderMap(): void {