refactor: timline refresh logic

This commit is contained in:
ccmdi 2025-11-21 15:38:26 -05:00
parent 0210388e46
commit 181b3bea1e
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View file

@ -55,10 +55,7 @@ export class MapBasesView extends BasesView {
this.register(
this.containerEl.onWindowMigrated(() => {
if (this.deck) {
this.destroyMap();
this.renderMap();
}
this.refresh();
})
);
}
@ -515,6 +512,7 @@ export class MapBasesView extends BasesView {
const stringData = value.toString().trim();
// Try to parse as JSON array
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const parsed = JSON.parse(stringData);
if (Array.isArray(parsed)) {
const coords: [number, number][] = [];

View file

@ -8,7 +8,6 @@ import {
import { MapPoint } from '../map-renderer';
import MapPlugin from '../main';
import { MapBasesView } from './map-bases-view';
import { updateMapPoints } from '../map-renderer';
export const MapTimelineBasesViewType = 'map-timeline';
const MAP_UPDATE_DEBOUNCE_TIME = 50;
@ -56,6 +55,11 @@ export class MapTimelineBasesView extends MapBasesView {
this.destroySlider();
}
refresh(): void {
this.destroySlider();
super.refresh();
}
private createSlider(): void {
const sliderContainer = this.mapEl.createDiv({ cls: 'bases-timeline-slider' });