- 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.
64 lines
2.1 KiB
Vue
64 lines
2.1 KiB
Vue
<template>
|
|
<!-- Context menu (tile) -->
|
|
<div
|
|
v-show="contextMenu.tile.show"
|
|
class="fixed z-[1000] bg-base-100/95 backdrop-blur-xl shadow-xl rounded-lg border border-base-300 py-1 min-w-[180px] transition-opacity duration-150"
|
|
:style="{ left: contextMenu.tile.x + 'px', top: contextMenu.tile.y + 'px' }"
|
|
>
|
|
<button
|
|
type="button"
|
|
class="btn btn-ghost btn-sm w-full justify-start hover:bg-base-200 transition-colors"
|
|
@click="onWipeTile(contextMenu.tile.data?.coords)"
|
|
>
|
|
Wipe tile {{ contextMenu.tile.data?.coords?.x }}, {{ contextMenu.tile.data?.coords?.y }}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="btn btn-ghost btn-sm w-full justify-start hover:bg-base-200 transition-colors"
|
|
@click="onRewriteCoords(contextMenu.tile.data?.coords)"
|
|
>
|
|
Rewrite tile coords
|
|
</button>
|
|
</div>
|
|
<!-- Context menu (marker) -->
|
|
<div
|
|
v-show="contextMenu.marker.show"
|
|
class="fixed z-[1000] bg-base-100/95 backdrop-blur-xl shadow-xl rounded-lg border border-base-300 py-1 min-w-[180px] transition-opacity duration-150"
|
|
:style="{ left: contextMenu.marker.x + 'px', top: contextMenu.marker.y + 'px' }"
|
|
>
|
|
<button
|
|
type="button"
|
|
class="btn btn-ghost btn-sm w-full justify-start hover:bg-base-200 transition-colors"
|
|
@click="onHideMarker(contextMenu.marker.data?.id)"
|
|
>
|
|
Hide marker {{ contextMenu.marker.data?.name }}
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { ContextMenuState } from '~/composables/useMapLogic'
|
|
|
|
defineProps<{
|
|
contextMenu: ContextMenuState
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
wipeTile: [coords: { x: number; y: number } | undefined]
|
|
rewriteCoords: [coords: { x: number; y: number } | undefined]
|
|
hideMarker: [id: number | undefined]
|
|
}>()
|
|
|
|
function onWipeTile(coords: { x: number; y: number } | undefined) {
|
|
if (coords) emit('wipeTile', coords)
|
|
}
|
|
|
|
function onRewriteCoords(coords: { x: number; y: number } | undefined) {
|
|
if (coords) emit('rewriteCoords', coords)
|
|
}
|
|
|
|
function onHideMarker(id: number | undefined) {
|
|
if (id != null) emit('hideMarker', id)
|
|
}
|
|
</script>
|