mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-05 09:52:54 +00:00
scrollable layer list
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import Label from '$lib/components/ui/label/label.svelte';
|
||||
import { Separator } from '$lib/components/ui/separator';
|
||||
import { ScrollArea } from '$lib/components/ui/scroll-area/index.js';
|
||||
|
||||
import Fa from 'svelte-fa';
|
||||
import { faLayerGroup } from '@fortawesome/free-solid-svg-icons';
|
||||
@@ -36,52 +37,56 @@
|
||||
class="transition-[grid-template-rows grid-template-cols] grid grid-rows-[0fr] grid-cols-[0fr] duration-150 group-hover:grid-rows-[1fr] group-hover:grid-cols-[1fr]"
|
||||
>
|
||||
<div class="overflow-hidden">
|
||||
<div class="p-2">
|
||||
<Label>Basemaps</Label>
|
||||
<LayerTree
|
||||
layerTree={basemapTree}
|
||||
name="basemaps"
|
||||
onValueChange={(id) => {
|
||||
if (map) {
|
||||
map.setStyle(basemaps[id]);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Separator class="w-full" />
|
||||
<div class="p-2">
|
||||
<Label>Overlays</Label>
|
||||
<LayerTree
|
||||
layerTree={overlayTree}
|
||||
name="overlays"
|
||||
multiple={true}
|
||||
onValueChange={(id, checked) => {
|
||||
if (map) {
|
||||
if (checked) {
|
||||
if (!map.getSource(id)) {
|
||||
map.addSource(id, overlays[id]);
|
||||
<ScrollArea>
|
||||
<div class="h-fit max-h-[50vh]">
|
||||
<div class="p-2">
|
||||
<Label>Basemaps</Label>
|
||||
<LayerTree
|
||||
layerTree={basemapTree}
|
||||
name="basemaps"
|
||||
onValueChange={(id) => {
|
||||
if (map) {
|
||||
map.setStyle(basemaps[id]);
|
||||
}
|
||||
map.addLayer({
|
||||
id,
|
||||
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
||||
source: id,
|
||||
paint: {
|
||||
...(id in opacities
|
||||
? overlays[id].type === 'raster'
|
||||
? { 'raster-opacity': opacities[id] }
|
||||
: { 'line-opacity': opacities[id] }
|
||||
: {})
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Separator class="w-full" />
|
||||
<div class="p-2">
|
||||
<Label>Overlays</Label>
|
||||
<LayerTree
|
||||
layerTree={overlayTree}
|
||||
name="overlays"
|
||||
multiple={true}
|
||||
onValueChange={(id, checked) => {
|
||||
if (map) {
|
||||
if (checked) {
|
||||
if (!map.getSource(id)) {
|
||||
map.addSource(id, overlays[id]);
|
||||
}
|
||||
map.addLayer({
|
||||
id,
|
||||
type: overlays[id].type === 'raster' ? 'raster' : 'line',
|
||||
source: id,
|
||||
paint: {
|
||||
...(id in opacities
|
||||
? overlays[id].type === 'raster'
|
||||
? { 'raster-opacity': opacities[id] }
|
||||
: { 'line-opacity': opacities[id] }
|
||||
: {})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
map.removeLayer(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
map.removeLayer(id);
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Separator class="w-full" />
|
||||
<div class="p-2">TODO: Add layer settings</div>
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Separator class="w-full" />
|
||||
<div class="p-2">TODO: Add layer settings</div>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</div>
|
||||
</CustomControl>
|
||||
|
Reference in New Issue
Block a user