Close context menu on mousedown
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user