From dca773b8c9beccb64f368eef760283525a0e92aa Mon Sep 17 00:00:00 2001 From: Colin Kallemein Date: Sat, 20 Jul 2024 18:53:45 +0200 Subject: [PATCH] (WIP) add virtual list to tiles --- src/components/utilities/zoneEditor/Tiles.vue | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/components/utilities/zoneEditor/Tiles.vue b/src/components/utilities/zoneEditor/Tiles.vue index dbf7770..80a4105 100644 --- a/src/components/utilities/zoneEditor/Tiles.vue +++ b/src/components/utilities/zoneEditor/Tiles.vue @@ -25,19 +25,21 @@ {{ tag }} -
-
- Tile +
+
+
+ Tile +
@@ -53,6 +55,7 @@ import { useZoneEditorStore } from '@/stores/zoneEditor' import { useGameStore } from '@/stores/game' import Modal from '@/components/utilities/Modal.vue' import type { Tile } from '@/types' +import { useVirtualList } from '@vueuse/core' const gameStore = useGameStore() const isModalOpen = ref(false) @@ -73,6 +76,14 @@ const filteredTiles = computed(() => { }) }); +const { list, containerProps, wrapperProps, scrollTo } = useVirtualList( + filteredTiles, + { + itemHeight: 40, + itemWidth: 72, + }, +) + const toggleTag = (tag: string) => { if (selectedTags.value.includes(tag)) { selectedTags.value = selectedTags.value.filter(t => t !== tag)