forked from noxious/client
Various zone editor UX improvements
This commit is contained in:
parent
f830bf875e
commit
ea9771e3ec
@ -1,9 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="overflow-hidden">
|
||||||
<Notifications />
|
<Notifications />
|
||||||
<Login v-if="screen === 'login'" />
|
<Login v-if="screen === 'login'" />
|
||||||
<Register v-if="screen === 'register'" />
|
<Register v-if="screen === 'register'" />
|
||||||
<Characters v-if="screen === 'characters'" />
|
<Characters v-if="screen === 'characters'" />
|
||||||
<Game v-if="screen === 'game'" />
|
<Game v-if="screen === 'game'" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -64,6 +64,25 @@ watch(
|
|||||||
{ deep: true }
|
{ deep: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// if ctrl is pressed and mouse is down , then drag the zone
|
||||||
|
scene.input.on(Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer) => {
|
||||||
|
if (pointer.event.altKey) {
|
||||||
|
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||||
|
} else if (zoneEditorStore.tool !== 'move') {
|
||||||
|
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zoom in and out
|
||||||
|
*/
|
||||||
|
scene.input.on(Phaser.Input.Events.POINTER_WHEEL, (pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[], deltaX: number, deltaY: number) => {
|
||||||
|
if (pointer.event.altKey) {
|
||||||
|
scene.scale.setZoom(scene.scale.zoom - deltaY * 0.01)
|
||||||
|
cam = scene.cameras.main
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Unload funcs
|
// Unload funcs
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
scene.input.off(Phaser.Input.Events.POINTER_MOVE, onPointerMove)
|
scene.input.off(Phaser.Input.Events.POINTER_MOVE, onPointerMove)
|
||||||
|
@ -114,6 +114,10 @@ function drawTile(pointer: Phaser.Input.Pointer) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pointer.event.altKey) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const px = scene.cameras.main.worldView.x + pointer.x
|
const px = scene.cameras.main.worldView.x + pointer.x
|
||||||
const py = scene.cameras.main.worldView.y + pointer.y
|
const py = scene.cameras.main.worldView.y + pointer.y
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Modal :is-modal-open="true" @modal:close="() => zoneEditorStore.toggleSettingsModal()" :modal-width="300" :modal-height="400" :is-resizable="false">
|
<Modal :is-modal-open="true" @modal:close="() => zoneEditorStore.toggleSettingsModal()" :modal-width="300" :modal-height="350" :is-resizable="false">
|
||||||
<template #modalHeader>
|
<template #modalHeader>
|
||||||
<h3 class="m-0 font-medium shrink-0">Zone settings</h3>
|
<h3 class="m-0 font-medium shrink-0">Zone settings</h3>
|
||||||
</template>
|
</template>
|
||||||
|
@ -62,6 +62,7 @@ const gameConfig = {
|
|||||||
width: window.innerWidth,
|
width: window.innerWidth,
|
||||||
height: window.innerHeight,
|
height: window.innerHeight,
|
||||||
type: Phaser.AUTO,
|
type: Phaser.AUTO,
|
||||||
|
resolution: 3,
|
||||||
pixelArt: true
|
pixelArt: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user