Close context menu on mousedown

This commit is contained in:
Alexis
2025-01-13 16:56:01 +01:00
parent 1eed243e7d
commit 5adc838e1e
2 changed files with 19 additions and 13 deletions

View File

@@ -35,8 +35,20 @@ const {
<MarkerCreator client:load mapKey={mapKey} />
</div>
<script lang="ts" define:vars={{ mapKey, zoomifyKey, markers, players, mapHeight, mapWidth, rulerDistanceRatio, rulerMainUnit, rulerHideWalkDistance }} defer>
<script
define:vars={{
mapKey,
zoomifyKey,
markers,
players,
mapHeight,
mapWidth,
rulerDistanceRatio,
rulerMainUnit,
rulerHideWalkDistance
}}
defer
>
// Units used for convertions to avoid changing original marker coords
const xRatio = .68447
const yRatio = .68447

View File

@@ -34,21 +34,15 @@ function switchMenuMode(newMode: MenuMode) {
onMounted(() => {
const mapRef = document.getElementById('world')
mapRef?.addEventListener('contextmenu', handleContextMenu)
// onLongPress(document.documentElement, handleLongPress, { delay: longPressDelay })
if (mapRef) {
mapRef.addEventListener('contextmenu', handleContextMenu)
mapRef.addEventListener('mousedown', hideMenu)
}
})
// function handleLongPress(e: Event) {
// hasBeenLongPressed.value = true
// longPressTimer.start()
// showMenu()
// }
function handleClickOutside(e: Event) {
// if (!hasBeenLongPressed.value) {
hideMenu()
// }
hideMenu()
}
function handleContextMenu(e: Event) {