mirror of
https://github.com/RGBCube/Site
synced 2025-08-01 13:37:49 +00:00
cube: adjust wheel sensitivity
This commit is contained in:
parent
ad30320a8e
commit
1a17723c54
1 changed files with 6 additions and 14 deletions
|
@ -52,22 +52,14 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
scale(factor) {
|
scale(factor) {
|
||||||
return Vec(
|
return Vec(this.x * factor, this.y * factor, this.z * factor);
|
||||||
this.x * factor,
|
|
||||||
this.y * factor,
|
|
||||||
this.z * factor,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
normalize() {
|
normalize() {
|
||||||
let length = this.length();
|
let length = this.length();
|
||||||
length = length == 0 ? 1 : length;
|
length = length == 0 ? 1 : length;
|
||||||
|
|
||||||
return Vec(
|
return Vec(this.x / length, this.y / length, this.z / length);
|
||||||
this.x / length,
|
|
||||||
this.y / length,
|
|
||||||
this.z / length,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -119,7 +111,7 @@
|
||||||
|
|
||||||
const friction = 3;
|
const friction = 3;
|
||||||
const sensitivityMouse = 0.01;
|
const sensitivityMouse = 0.01;
|
||||||
const sensitivityWheel = 0.005;
|
const sensitivityWheel = 0.006;
|
||||||
|
|
||||||
// One minute.
|
// One minute.
|
||||||
const screensaverTimeoutMs = 1 * 60 * 1000;
|
const screensaverTimeoutMs = 1 * 60 * 1000;
|
||||||
|
@ -137,8 +129,9 @@
|
||||||
set(q) {
|
set(q) {
|
||||||
this.quat = q;
|
this.quat = q;
|
||||||
|
|
||||||
this.element.style.transform =
|
this.element.style.transform = `rotate3d(${q.x}, ${q.y}, ${q.z}, ${
|
||||||
`rotate3d(${q.x}, ${q.y}, ${q.z}, ${Math.acos(q.w) * 2}rad)`;
|
Math.acos(q.w) * 2
|
||||||
|
}rad)`;
|
||||||
},
|
},
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
|
@ -191,7 +184,6 @@
|
||||||
impulseThisFrame = Vec.sum(impulseThisFrame, axis);
|
impulseThisFrame = Vec.sum(impulseThisFrame, axis);
|
||||||
|
|
||||||
const rotation = Quat.fromAxis(axis);
|
const rotation = Quat.fromAxis(axis);
|
||||||
|
|
||||||
orient.set(Quat.mul(rotation, orient.get()));
|
orient.set(Quat.mul(rotation, orient.get()));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue