aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 13:35:59 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 13:35:59 +0900
commit92b0483c65d2404a096d67a276395e9198499e95 (patch)
treeb14b7110a8b60b3a8bb9fa20fc4be886b635c32a
parent4830503fb3738098ab2395f3475459c5e330cb39 (diff)
bluebey-studio: Shift+ドラッグの移動量が加速する不具合を修正
-rw-r--r--public/bluebey-studio/src/main.js13
1 files changed, 11 insertions, 2 deletions
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);