1
0
forked from noxious/client

Removed virtualList stuff

This commit is contained in:
Dennis Postma 2024-07-20 20:33:29 +02:00
parent 87815dd68e
commit 84fe8d7198

View File

@ -1,6 +1,6 @@
<template>
<Teleport to="body">
<Modal v-if="isModalOpen" @modal:close="() => zoneEditorStore.setTool('move')" :isModalOpen="true" :modal-width="645" :modal-height="260">
<Modal v-if="isModalOpen" @modal:close="() => zoneEditorStore.setTool('move')" :isModalOpen="true" :modal-width="645" :modal-height="600">
<template #modalHeader>
<h3 class="text-lg">Tiles</h3>
<div class="flex">
@ -13,17 +13,17 @@
</div>
</template>
<template #modalBody>
<div class="m-[15px]">
<div class="flex flex-col h-full p-4">
<div class="mb-4 flex flex-wrap gap-2">
<button v-for="tag in uniqueTags" :key="tag" @click="toggleTag(tag)" class="btn-cyan" :class="{ 'opacity-50': !selectedTags.includes(tag) }">
{{ tag }}
</button>
</div>
<div v-bind="containerProps">
<div v-bind="wrapperProps" class="flex justify-start flex-wrap gap-2.5 content-start">
<div v-for="{ data: tile } in list" :key="tile.id" class="max-w-[25%] inline-block">
<div class="h-[calc(100%_-_60px)] flex-grow overflow-y-auto">
<div class="grid grid-cols-8 gap-2 justify-items-center">
<div v-for="tile in filteredTiles" :key="tile.id" class="flex items-center justify-center">
<img
class="border-2 border-solid max-w-full"
class="max-w-full max-h-full border-2 border-solid"
:src="`${config.server_endpoint}/assets/tiles/${tile.id}.png`"
alt="Tile"
@click="zoneEditorStore.setSelectedTile(tile)"
@ -49,7 +49,6 @@ 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)
@ -70,11 +69,6 @@ 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)