moar fixes

This commit is contained in:
2025-01-09 20:36:25 +01:00
parent 66c7ed2f23
commit b815aa9cc7

View File

@@ -19,15 +19,15 @@
let element: HTMLElement; let element: HTMLElement;
// let vis_x = $state(0); let vis_x = $state(0);
// let vis_y = $state(0); let vis_y = $state(0);
// $effect(() => { $effect(() => {
// vis_x = x + width / 2 - (element.clientWidth ?? 0) / 2; vis_x = x - (element.clientWidth ?? 0) / 2;
// vis_y = y + height / 2 - (element.clientHeight ?? 0) / 2; vis_y = y - (element.clientHeight ?? 0) / 2;
// }); });
let capturedPointerId: number | null = $state(null); let capturedPointerId: number | null = $state(null);
@@ -55,9 +55,9 @@
const y_send = y / height; const y_send = y / height;
ws?.send( ws?.send(
JSON.stringify({ JSON.stringify({
id, id: id,
x_send, x: x_send,
y_send, y: y_send,
}), }),
); );
} }
@@ -68,8 +68,8 @@
onpointerdown={onPointerDown} onpointerdown={onPointerDown}
onpointerup={onPointerUp} onpointerup={onPointerUp}
onpointermove={onPointerMove} onpointermove={onPointerMove}
style={`transform: translate(${x}px, ${y}px)`} style={`transform: translate(${vis_x}px, ${vis_y}px)`}
class="absolute flex h-40 w-40 touch-none select-none items-center justify-center rounded-full border-red-400 bg-red-400" class="absolute flex h-32 w-32 touch-none select-none items-center justify-center rounded-full border-red-400 bg-red-400"
> >
Tracker {id} Tracker {id}
</div> </div>