From 92b0483c65d2404a096d67a276395e9198499e95 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Thu, 22 Oct 2026 13:35:59 +0900 Subject: bluebey-studio: Shift+ドラッグの移動量が加速する不具合を修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/bluebey-studio/src/main.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'public/bluebey-studio') diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js index ac8c04b..063a6fc 100644 --- a/public/bluebey-studio/src/main.js +++ b/public/bluebey-studio/src/main.js @@ -2361,6 +2361,8 @@ async function init() { pan: event.shiftKey, x: event.clientX, y: event.clientY, + lastX: event.clientX, + lastY: event.clientY, root: [...root], }; view.controls.enabled = false; @@ -2376,11 +2378,18 @@ async function init() { if (modelDrag.pan) { // Shift+drag: move the camera's reference point (the same effect as the // two-finger drag on a phone). The character stays where it is. + // Use the step since the previous event, not the total from the press: + // pointermove fires many times per drag, so adding the total every time + // would make the pan accelerate. + const stepX = event.clientX - modelDrag.lastX; + const stepY = event.clientY - modelDrag.lastY; + modelDrag.lastX = event.clientX; + modelDrag.lastY = event.clientY; const right = new THREE.Vector3(1, 0, 0).applyQuaternion(view.camera.quaternion); const up = new THREE.Vector3(0, 1, 0).applyQuaternion(view.camera.quaternion); const move = new THREE.Vector3() - .addScaledVector(right, -dx * k) - .addScaledVector(up, dy * k); + .addScaledVector(right, -stepX * k) + .addScaledVector(up, stepY * k); view.target.add(move); for (const controls of Object.values(view.controlsMap ?? {})) controls.target.add(move); for (const cam of Object.values(view.cameras ?? {})) cam.position.add(move); -- cgit v1.3.1