- Added a new AGENTS.md file to document the project structure and conventions. - Updated .gitignore to include node_modules and refined cursor rules. - Introduced new backend and frontend components for improved map interactions, including context menus and controls. - Enhanced API composables for better admin and authentication functionalities. - Refactored existing components for cleaner code and improved user experience. - Updated README.md to clarify production asset serving and user setup instructions.
62 lines
1.8 KiB
Vue
62 lines
1.8 KiB
Vue
<template>
|
|
<dialog ref="modalRef" class="modal" @cancel="$emit('close')">
|
|
<div class="modal-box transition-all duration-200" @click.stop>
|
|
<h3 class="font-bold text-lg">Rewrite tile coords</h3>
|
|
<p class="py-2">From ({{ coordSetFrom.x }}, {{ coordSetFrom.y }}) to:</p>
|
|
<div class="flex gap-2">
|
|
<input v-model.number="localTo.x" type="number" class="input input-bordered flex-1" placeholder="X" />
|
|
<input v-model.number="localTo.y" type="number" class="input input-bordered flex-1" placeholder="Y" />
|
|
</div>
|
|
<div class="modal-action">
|
|
<form method="dialog" @submit.prevent="onSubmit">
|
|
<button type="submit" class="btn btn-primary">Submit</button>
|
|
<button type="button" class="btn" @click="$emit('close')">Cancel</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="modal-backdrop cursor-pointer" aria-label="Close" @click="$emit('close')" />
|
|
</dialog>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
coordSetFrom: { x: number; y: number }
|
|
coordSet: { x: number; y: number }
|
|
open: boolean
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
close: []
|
|
submit: [from: { x: number; y: number }; to: { x: number; y: number }]
|
|
}>()
|
|
|
|
const modalRef = ref<HTMLDialogElement | null>(null)
|
|
const localTo = ref({ x: props.coordSet.x, y: props.coordSet.y })
|
|
|
|
watch(
|
|
() => props.open,
|
|
(open) => {
|
|
if (open) {
|
|
localTo.value = { x: props.coordSet.x, y: props.coordSet.y }
|
|
nextTick(() => modalRef.value?.showModal())
|
|
} else {
|
|
modalRef.value?.close()
|
|
}
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
|
|
watch(
|
|
() => props.coordSet,
|
|
(c) => {
|
|
localTo.value = { x: c.x, y: c.y }
|
|
},
|
|
{ deep: true }
|
|
)
|
|
|
|
function onSubmit() {
|
|
emit('submit', props.coordSetFrom, localTo.value)
|
|
emit('close')
|
|
}
|
|
</script>
|