Map editor ui fixes, switching back to game from map editor, draw/tap checkbox, and partial restoration of tile picker function

This commit is contained in:
2025-01-27 14:33:29 -06:00
parent 9e652868ca
commit 6bede8c44e
7 changed files with 35 additions and 21 deletions

View File

@ -111,10 +111,15 @@ function tilePicker(pointer: Phaser.Input.Pointer) {
let map = mapEditor.currentMap.value
if (!map) return
console.log("herer")
if (!tileMap.value || !tileLayer.value) return
// Check if there is a tile
const tile = getTile(tileLayer.value!, pointer.worldX, pointer.worldY)
const tile = getTile(tileLayer.value, pointer.worldX, pointer.worldY)
if (!tile) return
console.log(tile.index)
// Select the tile
mapEditor.setSelectedTile(map.tiles[tile.y][tile.x])
}
@ -145,7 +150,11 @@ function handlePointer(pointer: Phaser.Input.Pointer) {
if (pointer.event.shiftKey) return
// Check if alt is pressed
if (pointer.event.altKey) return
if (pointer.event.altKey) {
tilePicker(pointer);
return
}
// Check if draw mode is tile
switch (mapEditor.tool.value) {
case 'pencil':
@ -157,9 +166,6 @@ function handlePointer(pointer: Phaser.Input.Pointer) {
case 'paint':
paint(pointer)
break
case 'tile picker':
tilePicker(pointer)
break
}
}