-
![Wall]()
+
+
+
+
+
+
+
+
+
@@ -20,10 +26,10 @@ import config from '@/config'
import Modal from '@/components/utilities/Modal.vue'
import { useZoneEditorStore } from '@/stores/zoneEditor'
-const wallWidth = config.wall_size.x
-const wallHeight = config.wall_size.y
-const walls = ref
([])
-const selectedWall = ref(null)
+const decorationWidth = config.wall_size.x
+const decorationHeight = config.wall_size.y
+const decorations = ref([])
+const selectedDecoration = ref(null)
const canvas = ref(null)
const isModalOpen = ref(false)
const zoneEditorStore = useZoneEditorStore()
@@ -39,7 +45,7 @@ const loadImage = (src: string): Promise => {
})
}
-const splitWalls = (img: HTMLImageElement) => {
+const splitDecorations = (img: HTMLImageElement) => {
if (!canvas.value) {
console.error('Canvas not found')
return
@@ -50,48 +56,48 @@ const splitWalls = (img: HTMLImageElement) => {
return
}
- const wallsetWidth = img.width
- const wallsetHeight = img.height
- const columns = Math.floor(wallsetWidth / wallWidth)
- const rows = Math.floor(wallsetHeight / wallHeight)
+ const decorationsetWidth = img.width
+ const decorationsetHeight = img.height
+ const columns = Math.floor(decorationsetWidth / decorationWidth)
+ const rows = Math.floor(decorationsetHeight / decorationHeight)
- walls.value = []
- selectedWall.value = null
+ decorations.value = []
+ selectedDecoration.value = null
for (let row = 0; row < rows; row++) {
for (let col = 0; col < columns; col++) {
- const x = col * wallWidth
- const y = row * wallHeight
+ const x = col * decorationWidth
+ const y = row * decorationHeight
- ctx.clearRect(0, 0, wallWidth, wallHeight)
- ctx.drawImage(img, x, y, wallWidth, wallHeight, 0, 0, wallWidth, wallHeight)
+ ctx.clearRect(0, 0, decorationWidth, decorationHeight)
+ ctx.drawImage(img, x, y, decorationWidth, decorationHeight, 0, 0, decorationWidth, decorationHeight)
- const wallDataURL = canvas.value.toDataURL()
- walls.value.push(wallDataURL)
+ const decorationDataURL = canvas.value.toDataURL()
+ decorations.value.push(decorationDataURL)
}
}
}
-const selectWall = (index: number) => {
- selectedWall.value = index
+const selectDecoration = (index: number) => {
+ selectedDecoration.value = index
}
onMounted(async () => {
isModalOpen.value = true
const img = await loadImage(imagePath)
await nextTick()
- splitWalls(img)
+ splitDecorations(img)
})
diff --git a/src/components/utilities/zoneEditor/Toolbar.vue b/src/components/utilities/zoneEditor/Toolbar.vue
index 2f02fda..ee24ab6 100644
--- a/src/components/utilities/zoneEditor/Toolbar.vue
+++ b/src/components/utilities/zoneEditor/Toolbar.vue
@@ -17,7 +17,6 @@
Tile
-
Wall
Decoration
Teleport
Blocking tile
diff --git a/src/components/utilities/zoneEditor/Walls.vue b/src/components/utilities/zoneEditor/Walls.vue
deleted file mode 100644
index 00291fb..0000000
--- a/src/components/utilities/zoneEditor/Walls.vue
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
- Walls
-
-
-
-
-
![Wall]()
-
-
-
-
-
-
-
-
-
diff --git a/src/components/utilities/zoneEditor/ZoneEditor.vue b/src/components/utilities/zoneEditor/ZoneEditor.vue
index 1d6596e..e4b9239 100644
--- a/src/components/utilities/zoneEditor/ZoneEditor.vue
+++ b/src/components/utilities/zoneEditor/ZoneEditor.vue
@@ -1,34 +1,44 @@
-
+
+
+
+
+
+
+
+
-
+
+