Close context menu on mousedown
This commit is contained in:
@@ -35,8 +35,20 @@ const {
|
|||||||
<MarkerCreator client:load mapKey={mapKey} />
|
<MarkerCreator client:load mapKey={mapKey} />
|
||||||
</div>
|
</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
|
// Units used for convertions to avoid changing original marker coords
|
||||||
const xRatio = .68447
|
const xRatio = .68447
|
||||||
const yRatio = .68447
|
const yRatio = .68447
|
||||||
|
|||||||
@@ -34,21 +34,15 @@ function switchMenuMode(newMode: MenuMode) {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const mapRef = document.getElementById('world')
|
const mapRef = document.getElementById('world')
|
||||||
mapRef?.addEventListener('contextmenu', handleContextMenu)
|
if (mapRef) {
|
||||||
// onLongPress(document.documentElement, handleLongPress, { delay: longPressDelay })
|
mapRef.addEventListener('contextmenu', handleContextMenu)
|
||||||
|
mapRef.addEventListener('mousedown', hideMenu)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// function handleLongPress(e: Event) {
|
|
||||||
// hasBeenLongPressed.value = true
|
|
||||||
// longPressTimer.start()
|
|
||||||
|
|
||||||
// showMenu()
|
|
||||||
// }
|
|
||||||
|
|
||||||
function handleClickOutside(e: Event) {
|
function handleClickOutside(e: Event) {
|
||||||
// if (!hasBeenLongPressed.value) {
|
|
||||||
hideMenu()
|
hideMenu()
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleContextMenu(e: Event) {
|
function handleContextMenu(e: Event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user