Spaces:
Running
Running
antimatter15
commited on
Commit
•
90daab1
1
Parent(s):
e8dd2e6
preserving z axis on forward/back
Browse files
main.js
CHANGED
@@ -867,13 +867,14 @@ async function main() {
|
|
867 |
} else if (e.ctrlKey || e.metaKey) {
|
868 |
// inv = rotate4(inv, (e.deltaX * scale) / innerWidth, 0, 0, 1);
|
869 |
// inv = translate4(inv, 0, (e.deltaY * scale) / innerHeight, 0);
|
870 |
-
|
871 |
inv = translate4(
|
872 |
inv,
|
873 |
0,
|
874 |
0,
|
875 |
(-10 * (e.deltaY * scale)) / innerHeight,
|
876 |
);
|
|
|
877 |
} else {
|
878 |
let d = 4;
|
879 |
inv = translate4(inv, 0, 0, d);
|
@@ -923,12 +924,14 @@ async function main() {
|
|
923 |
} else if (down == 2) {
|
924 |
let inv = invert4(viewMatrix);
|
925 |
// inv = rotateY(inv, );
|
|
|
926 |
inv = translate4(
|
927 |
inv,
|
928 |
(-10 * (e.clientX - startX)) / innerWidth,
|
929 |
0,
|
930 |
(10 * (e.clientY - startY)) / innerHeight,
|
931 |
);
|
|
|
932 |
viewMatrix = invert4(inv);
|
933 |
|
934 |
startX = e.clientX;
|
@@ -1013,7 +1016,12 @@ async function main() {
|
|
1013 |
let inv = invert4(viewMatrix);
|
1014 |
// inv = translate4(inv, 0, 0, d);
|
1015 |
inv = rotate4(inv, dtheta, 0, 0, 1);
|
1016 |
-
|
|
|
|
|
|
|
|
|
|
|
1017 |
|
1018 |
viewMatrix = invert4(inv);
|
1019 |
|
@@ -1045,9 +1053,17 @@ async function main() {
|
|
1045 |
|
1046 |
const frame = (now) => {
|
1047 |
let inv = invert4(viewMatrix);
|
1048 |
-
|
1049 |
-
if (activeKeys.includes("ArrowUp"))
|
1050 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
if (activeKeys.includes("ArrowLeft"))
|
1052 |
inv = translate4(inv, -0.03, 0, 0);
|
1053 |
//
|
|
|
867 |
} else if (e.ctrlKey || e.metaKey) {
|
868 |
// inv = rotate4(inv, (e.deltaX * scale) / innerWidth, 0, 0, 1);
|
869 |
// inv = translate4(inv, 0, (e.deltaY * scale) / innerHeight, 0);
|
870 |
+
let preY = inv[13];
|
871 |
inv = translate4(
|
872 |
inv,
|
873 |
0,
|
874 |
0,
|
875 |
(-10 * (e.deltaY * scale)) / innerHeight,
|
876 |
);
|
877 |
+
inv[13] = preY
|
878 |
} else {
|
879 |
let d = 4;
|
880 |
inv = translate4(inv, 0, 0, d);
|
|
|
924 |
} else if (down == 2) {
|
925 |
let inv = invert4(viewMatrix);
|
926 |
// inv = rotateY(inv, );
|
927 |
+
let preY = inv[13];
|
928 |
inv = translate4(
|
929 |
inv,
|
930 |
(-10 * (e.clientX - startX)) / innerWidth,
|
931 |
0,
|
932 |
(10 * (e.clientY - startY)) / innerHeight,
|
933 |
);
|
934 |
+
inv[13] = preY
|
935 |
viewMatrix = invert4(inv);
|
936 |
|
937 |
startX = e.clientX;
|
|
|
1016 |
let inv = invert4(viewMatrix);
|
1017 |
// inv = translate4(inv, 0, 0, d);
|
1018 |
inv = rotate4(inv, dtheta, 0, 0, 1);
|
1019 |
+
|
1020 |
+
inv = translate4(inv, -dx / innerWidth, -dy / innerHeight, 0);
|
1021 |
+
|
1022 |
+
let preY = inv[13];
|
1023 |
+
inv = translate4(inv, 0, 0, 10 * (1 - dscale));
|
1024 |
+
inv[13] = preY
|
1025 |
|
1026 |
viewMatrix = invert4(inv);
|
1027 |
|
|
|
1053 |
|
1054 |
const frame = (now) => {
|
1055 |
let inv = invert4(viewMatrix);
|
1056 |
+
|
1057 |
+
if (activeKeys.includes("ArrowUp")){
|
1058 |
+
let preY = inv[13];
|
1059 |
+
inv = translate4(inv, 0, 0, 0.1);
|
1060 |
+
inv[13] = preY
|
1061 |
+
}
|
1062 |
+
if (activeKeys.includes("ArrowDown")){
|
1063 |
+
let preY = inv[13];
|
1064 |
+
inv = translate4(inv, 0, 0, -0.1);
|
1065 |
+
inv[13] = preY
|
1066 |
+
}
|
1067 |
if (activeKeys.includes("ArrowLeft"))
|
1068 |
inv = translate4(inv, -0.03, 0, 0);
|
1069 |
//
|