reactive modifications

This commit is contained in:
vcoppe
2024-04-24 22:35:53 +02:00
parent ae7806a553
commit e7dbb07ace
7 changed files with 88 additions and 71 deletions

View File

@@ -5,7 +5,7 @@
import { GPXStatistics } from 'gpx';
import { selectedFiles, settings } from '$lib/stores';
import { getFileStore, selectedFiles, settings } from '$lib/stores';
import { get } from 'svelte/store';
import { MoveDownRight, MoveUpRight, Ruler, Timer, Zap } from 'lucide-svelte';
@@ -14,12 +14,16 @@
let gpxData: GPXStatistics = new GPXStatistics();
$: {
function updateGPXData() {
gpxData = new GPXStatistics();
$selectedFiles.forEach((file) => {
gpxData.mergeWith(get(file).statistics);
gpxData.mergeWith(file.statistics);
});
}
$: if ($selectedFiles) {
updateGPXData();
}
</script>
<Card.Root class="h-full overflow-hidden border-none min-w-48 pl-4">