feat(frontend): better stealth overlay
This commit is contained in:
@@ -1,7 +1,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let stealthMode = $state(false);
|
let stealthMode = $state(false);
|
||||||
let lastTap = $state({ time: 0, x: 0, y: 0 });
|
let lastTap = $state({ time: 0, x: 0, y: 0 });
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
document.body.style.touchAction = 'manipulation';
|
||||||
|
return () => {
|
||||||
|
document.body.style.touchAction = '';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
function isInCenterZone(x: number, y: number): boolean {
|
function isInCenterZone(x: number, y: number): boolean {
|
||||||
const w = window.innerWidth;
|
const w = window.innerWidth;
|
||||||
const h = window.innerHeight;
|
const h = window.innerHeight;
|
||||||
@@ -25,7 +34,7 @@
|
|||||||
const distX = Math.abs(x - lastTap.x);
|
const distX = Math.abs(x - lastTap.x);
|
||||||
const distY = Math.abs(y - lastTap.y);
|
const distY = Math.abs(y - lastTap.y);
|
||||||
|
|
||||||
if (timeDiff < 300 && distX < 50 && distY < 50) {
|
if (timeDiff < 500 && distX < 50 && distY < 50) {
|
||||||
stealthMode = !stealthMode;
|
stealthMode = !stealthMode;
|
||||||
lastTap = { time: 0, x: 0, y: 0 };
|
lastTap = { time: 0, x: 0, y: 0 };
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user