forked from noxious/client
TS improvements
This commit is contained in:
parent
c1edf31ca0
commit
110fd4e608
@ -100,7 +100,7 @@ export enum MapEventTileType {
|
||||
|
||||
export type MapEventTile = {
|
||||
id: string
|
||||
mapid: string
|
||||
mapId: string
|
||||
type: MapEventTileType
|
||||
positionX: number
|
||||
positionY: number
|
||||
|
@ -46,7 +46,9 @@ class EventTileCommand implements EditorCommand {
|
||||
}
|
||||
}
|
||||
|
||||
function createCommandUpdate(tile?: MapEventTile, operation: 'draw' | 'erase' | 'clear') {
|
||||
function createCommandUpdate(tile?: MapEventTile | null, operation: 'draw' | 'erase' | 'clear' = 'draw') {
|
||||
if (!tile) return
|
||||
|
||||
if (!currentCommand) {
|
||||
currentCommand = new EventTileCommand(operation)
|
||||
}
|
||||
@ -106,9 +108,9 @@ function pencil(pointer: Phaser.Input.Pointer, map: MapT) {
|
||||
: undefined
|
||||
}
|
||||
|
||||
createCommandUpdate(newEventTile, 'draw')
|
||||
createCommandUpdate(newEventTile as MapEventTile, 'draw')
|
||||
|
||||
map.mapEventTiles.push(newEventTile)
|
||||
map.mapEventTiles.push(newEventTile as MapEventTile)
|
||||
}
|
||||
|
||||
function erase(pointer: Phaser.Input.Pointer, map: MapT) {
|
||||
@ -149,7 +151,7 @@ function handlePointer(pointer: Phaser.Input.Pointer) {
|
||||
}
|
||||
|
||||
function clearTiles() {
|
||||
if (mapEditor.currentMap.value.mapEventTiles.length === 0) return
|
||||
if (mapEditor.currentMap.value?.mapEventTiles.length === 0) return
|
||||
createCommandUpdate(null, 'clear')
|
||||
finalizeCommand()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user