aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src
diff options
context:
space:
mode:
Diffstat (limited to 'public/bluebey-studio/src')
-rw-r--r--public/bluebey-studio/src/main.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js
index 063a6fc..8d69154 100644
--- a/public/bluebey-studio/src/main.js
+++ b/public/bluebey-studio/src/main.js
@@ -2320,11 +2320,12 @@ async function init() {
help?.addEventListener('click', (event) => { if (event.target === help) toggleHelp(false); });
// --- the mouse on the character ----------------------------------------
- // Dragging the model slides it across the view; holding Shift and dragging
- // moves the camera's reference point instead (the phone's two-finger drag).
- // Bone posing lives in the panel, so the mouse never grabs a bone (see `Rig`
- // in src/rig.js). On a small screen the panel is a sheet over the view, so a
- // tap on the view first just dismisses the sheet.
+ // Dragging the model moves the camera's reference point, so the scene slides
+ // under the cursor; holding Shift and dragging moves the character itself.
+ // On touch, dragging the model always moves the character (the phone
+ // gestures). Bone posing lives in the panel, so the mouse never grabs a bone
+ // (see `Rig` in src/rig.js). On a small screen the panel is a sheet over the
+ // view, so a tap on the view first just dismisses the sheet.
const dragRay = new THREE.Raycaster();
const dragNdc = new THREE.Vector2();
const dragHitAt = (event) => {
@@ -2358,7 +2359,7 @@ async function init() {
const root = state.pose.root ?? [0, 0, 0];
modelDrag = {
pointerId: event.pointerId,
- pan: event.shiftKey,
+ pan: event.pointerType === 'mouse' ? !event.shiftKey : false,
x: event.clientX,
y: event.clientY,
lastX: event.clientX,
@@ -2376,7 +2377,7 @@ async function init() {
const dy = event.clientY - modelDrag.y;
const k = dragScale();
if (modelDrag.pan) {
- // Shift+drag: move the camera's reference point (the same effect as the
+ // Plain 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
@@ -2395,8 +2396,8 @@ async function init() {
for (const cam of Object.values(view.cameras ?? {})) cam.position.add(move);
view.captureInto(state.view);
} else {
- // Plain drag: slide the character, leaving the camera's reference point
- // alone (the one-finger drag on a phone).
+ // Shift+drag (or any touch drag on the character): slide the character,
+ // leaving the camera's reference point alone.
state.pose.root = [
round2(modelDrag.root[0] + dx * k),
round2(modelDrag.root[1] - dy * k),