mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 14:05:35 +02:00
wip
This commit is contained in:
@@ -216,7 +216,6 @@ const resolution = computed<number>(() => resolutionRaw.value ?? resolutionAutoV
|
||||
const useVirtualJoystick = true;
|
||||
|
||||
const wasdVec = { x: 0, y: 0 };
|
||||
const pointerVec = { x: 0, y: 0 };
|
||||
let isDashing = false;
|
||||
|
||||
const joyStickRadiusPx = 100;
|
||||
@@ -381,51 +380,6 @@ onMounted(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
canvas.value!.addEventListener('pointerdown', (ev) => {
|
||||
pointerVec.x = ev.clientX;
|
||||
pointerVec.y = ev.clientY;
|
||||
|
||||
let timeoutId: number | null = null;
|
||||
|
||||
const onMove = (ev: PointerEvent) => {
|
||||
if (timeoutId != null) {
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
const before = pointerVec;
|
||||
const after = { x: ev.clientX, y: ev.clientY };
|
||||
|
||||
controller.setCameraRotateVector({
|
||||
x: after.x - before.x,
|
||||
y: after.y - before.y,
|
||||
});
|
||||
|
||||
pointerVec.x = after.x;
|
||||
pointerVec.y = after.y;
|
||||
|
||||
timeoutId = window.setTimeout(() => {
|
||||
timeoutId = null;
|
||||
|
||||
controller.setCameraRotateVector({
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
||||
canvas.value!.addEventListener('pointermove', onMove);
|
||||
|
||||
canvas.value!.addEventListener('pointerup', (ev) => {
|
||||
canvas.value!.removeEventListener('pointermove', onMove);
|
||||
|
||||
pointerVec.x = 0;
|
||||
pointerVec.y = 0;
|
||||
|
||||
controller.setCameraRotateVector(pointerVec);
|
||||
});
|
||||
});
|
||||
|
||||
watch([graphicsQuality, fps, resolution], () => {
|
||||
refresh();
|
||||
});
|
||||
|
||||
@@ -188,8 +188,60 @@ export class RoomController {
|
||||
}
|
||||
|
||||
private onCanvasPointerdown(ev: PointerEvent) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
this.pointerDownPosition = { x: ev.offsetX, y: ev.offsetY };
|
||||
this.canvas!.setPointerCapture(ev.pointerId);
|
||||
|
||||
const pointerVec = { x: ev.clientX, y: ev.clientY };
|
||||
|
||||
let timeoutId: number | null = null;
|
||||
|
||||
const onMove = (ev: PointerEvent) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
if (timeoutId != null) {
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
const before = pointerVec;
|
||||
const after = { x: ev.clientX, y: ev.clientY };
|
||||
|
||||
this.setCameraRotateVector({
|
||||
x: after.x - before.x,
|
||||
y: after.y - before.y,
|
||||
});
|
||||
|
||||
pointerVec.x = after.x;
|
||||
pointerVec.y = after.y;
|
||||
|
||||
timeoutId = window.setTimeout(() => {
|
||||
timeoutId = null;
|
||||
|
||||
this.setCameraRotateVector({
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
}, 10);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
this.canvas!.addEventListener('pointermove', onMove);
|
||||
|
||||
this.canvas!.addEventListener('pointerup', (ev) => {
|
||||
this.canvas!.removeEventListener('pointermove', onMove);
|
||||
|
||||
pointerVec.x = 0;
|
||||
pointerVec.y = 0;
|
||||
|
||||
this.setCameraRotateVector(pointerVec);
|
||||
}, { once: true });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private onCanvasPointerup(ev: PointerEvent) {
|
||||
|
||||
Reference in New Issue
Block a user