mirror of
https://github.com/ccmdi/obsidian-map-plus.git
synced 2026-07-22 06:43:14 +00:00
feat: rerender on relevant config change
This commit is contained in:
parent
6149be3a48
commit
4642648a69
1 changed files with 9 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue