feat: add card zoom on every page; add card zoom on right click
release-tag / release-image (push) Successful in 30s
release-tag / release-image (push) Successful in 30s
Closes #32 Partial #29
This commit is contained in:
@@ -42,6 +42,19 @@ function keyUpHandler(e: KeyboardEvent) {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
function mouseDownHandler(e: MouseEvent) {
|
||||||
|
if (e.button !== 2) { return }
|
||||||
|
goStore.zoomKeyPressed = true
|
||||||
|
e.preventDefault()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function mouseUpHandler(e: MouseEvent) {
|
||||||
|
if (e.button !== 2) { return }
|
||||||
|
goStore.zoomKeyPressed = false
|
||||||
|
e.preventDefault()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
function follow_mouse(e: MouseEvent) {
|
function follow_mouse(e: MouseEvent) {
|
||||||
goStore.clientMouseX = e.clientX
|
goStore.clientMouseX = e.clientX
|
||||||
@@ -49,14 +62,14 @@ function follow_mouse(e: MouseEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener("keydown", (keyDownHandler))
|
window.addEventListener("mousedown", mouseDownHandler)
|
||||||
window.addEventListener("keyup", keyUpHandler)
|
window.addEventListener("mouseup", mouseUpHandler)
|
||||||
document.addEventListener("mousemove", follow_mouse)
|
document.addEventListener("mousemove", follow_mouse)
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener("keydown", (keyDownHandler))
|
window.removeEventListener("mousedown", mouseDownHandler)
|
||||||
window.removeEventListener("keyup", keyUpHandler)
|
window.removeEventListener("mouseup", mouseUpHandler)
|
||||||
document.removeEventListener("mousemove", follow_mouse)
|
document.removeEventListener("mousemove", follow_mouse)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -64,6 +77,7 @@ onDeactivated
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="root_dom_div">
|
<div class="root_dom_div">
|
||||||
|
<CardOverlay v-if="goStore.zoomKeyPressed" :card_id="goStore.hoveredCard" />
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import goStore, { setReady } from "@/netcode";
|
|||||||
<GameBoard v-if="goStore.context != 'lobby' && goStore.context != 'login'"></GameBoard>
|
<GameBoard v-if="goStore.context != 'lobby' && goStore.context != 'login'"></GameBoard>
|
||||||
<LobbyView v-if="goStore.context == 'lobby'"></LobbyView>
|
<LobbyView v-if="goStore.context == 'lobby'"></LobbyView>
|
||||||
<RulesDisplay v-if="goStore.context == 'rules'"></RulesDisplay>
|
<RulesDisplay v-if="goStore.context == 'rules'"></RulesDisplay>
|
||||||
<CardOverlay v-if="goStore.zoomKeyPressed" :card_id="goStore.hoveredCard">
|
|
||||||
</CardOverlay>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user