Small styling adjustment on buttons. Some zone editor stuff.

This commit is contained in:
2024-07-07 04:32:16 +02:00
parent 317906eab5
commit 89a781470b
7 changed files with 46 additions and 38 deletions

View File

@ -104,13 +104,13 @@ function paint(tile: Phaser.Tilemaps.Tile) {
}
function save() {
if (!zoneEditorStore.name) return
socket.connection.emit('gm:zone_editor:zone:update', {
zoneId: socket.character.zoneId,
name: zoneEditorStore.name,
width: zoneEditorStore.width,
height: zoneEditorStore.height,
tiles: zoneEditorStore.tiles,
objects: zoneEditorStore.objects
tiles: tiles.gidMap,
})
}

View File

@ -2,7 +2,7 @@
<CreateZone @submit="fetchZones" v-if="zoneEditorStore.isCreateZoneModalShown" />
<Teleport to="body">
<Modal @modal:close="() => zoneEditorStore.toggleZoneListModal()" :is-resizable="false" :is-modal-open="true" :modal-width="200" :modal-height="360">
<Modal @modal:close="() => zoneEditorStore.toggleZoneListModal()" :is-resizable="false" :is-modal-open="true" :modal-width="300" :modal-height="360">
<template #modalHeader>
<h3 class="text-lg">Zones</h3>
</template>
@ -13,10 +13,9 @@
</div>
<div class="relative p-2.5 cursor-pointer flex gap-y-2.5 gap-x-5 flex-wrap" v-for="(zone, index) in zones" :key="zone.id">
<div class="absolute left-0 top-0 w-full h-[1px] bg-cyan-200" v-if="index === 0"></div>
<div class="flex items-center">
<span>{{ zone.name }}</span>
<!-- @TODO : BUG , ml-auto no work -->
<span class="ml-auto">
<div class="flex gap-3 items-center w-full">
<span @click="() => loadZone(zone.id)">{{ zone.name }}</span>
<span class="ml-auto gap-1 flex">
<button class="btn-bordeaux py-0.5 px-2.5" @click="() => deleteZone(zone.id)">X</button>
</span>
</div>
@ -50,6 +49,13 @@ function fetchZones() {
})
}
function loadZone(id: number) {
console.log('loadZone', id)
socket.connection.emit('gm:zone_editor:zone:load', { zoneId: id }, () => {
zoneEditorStore.toggleZoneListModal()
})
}
function deleteZone(id: number) {
socket.connection.emit('gm:zone_editor:zone:delete', { zoneId: id }, () => {
fetchZones()