2023-03-29 17:21:20 +02:00
|
|
|
<script lang="ts">
|
|
|
|
/**
|
|
|
|
* This overlay element will regularly show a hand that swipes over the underlying element.
|
|
|
|
* This element will hide as soon as the Store 'hideSignal' receives a change (which is not undefined)
|
|
|
|
*/
|
2023-06-14 20:39:36 +02:00
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
|
|
|
import { onDestroy } from "svelte"
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
let mainElem: HTMLElement
|
|
|
|
export let hideSignal: Store<any>
|
|
|
|
function hide() {
|
|
|
|
mainElem.style.visibility = "hidden"
|
2023-03-29 17:21:20 +02:00
|
|
|
}
|
2023-06-14 23:21:19 +02:00
|
|
|
let initTime = Date.now()
|
2023-03-29 17:21:20 +02:00
|
|
|
if (hideSignal) {
|
2023-06-14 20:39:36 +02:00
|
|
|
onDestroy(
|
|
|
|
hideSignal.addCallbackD(() => {
|
2023-06-15 16:12:46 +02:00
|
|
|
if (initTime + 1000 > Date.now()) {
|
2023-06-14 23:21:19 +02:00
|
|
|
console.log("Ignoring hide signal")
|
|
|
|
return
|
|
|
|
}
|
2023-06-14 20:39:36 +02:00
|
|
|
console.log("Received hide signal")
|
|
|
|
hide()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
)
|
2023-03-29 17:21:20 +02:00
|
|
|
}
|
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
$: {
|
|
|
|
mainElem?.addEventListener("click", (_) => hide())
|
|
|
|
mainElem?.addEventListener("touchstart", (_) => hide())
|
|
|
|
}
|
|
|
|
</script>
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-15 16:12:46 +02:00
|
|
|
<div bind:this={mainElem} class="pointer-events-none absolute bottom-0 right-0 h-full w-full">
|
2023-06-14 23:21:19 +02:00
|
|
|
<div id="hand-container">
|
2023-06-14 20:39:36 +02:00
|
|
|
<img src="./assets/svg/hand.svg" />
|
2023-03-29 17:21:20 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2023-06-14 20:39:36 +02:00
|
|
|
@keyframes hand-drag-animation {
|
|
|
|
/* This is the animation on the little extra hand on the location input. If fades in, invites the user to interact/drag the map */
|
|
|
|
0% {
|
|
|
|
opacity: 0;
|
|
|
|
transform: rotate(-30deg);
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
6% {
|
|
|
|
opacity: 1;
|
|
|
|
transform: rotate(-30deg);
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
12% {
|
|
|
|
opacity: 1;
|
|
|
|
transform: rotate(-45deg);
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
24% {
|
|
|
|
opacity: 1;
|
|
|
|
transform: rotate(-00deg);
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
30% {
|
|
|
|
opacity: 1;
|
|
|
|
transform: rotate(-30deg);
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
36% {
|
|
|
|
opacity: 0;
|
|
|
|
transform: rotate(-30deg);
|
2023-03-29 17:21:20 +02:00
|
|
|
}
|
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
100% {
|
|
|
|
opacity: 0;
|
|
|
|
transform: rotate(-30deg);
|
|
|
|
}
|
|
|
|
}
|
2023-03-29 17:21:20 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
#hand-container {
|
|
|
|
position: absolute;
|
|
|
|
width: 2rem;
|
|
|
|
left: calc(50% + 4rem);
|
|
|
|
top: calc(50%);
|
|
|
|
opacity: 0.7;
|
|
|
|
animation: hand-drag-animation 4s ease-in-out infinite;
|
|
|
|
transform-origin: 50% 125%;
|
2023-03-29 17:21:20 +02:00
|
|
|
}
|
|
|
|
</style>
|