diff --git a/main.js b/main.js
index b0e52e8e592db55536dd4f9aff81e88e976b5136..996a34b107b31caef94b6ffe55ad0608ebc58266 100644
--- a/main.js
+++ b/main.js
@@ -128,6 +128,7 @@ document.querySelector("#app").innerHTML = `
<li><i class="fa-solid fa-left-right"></i> <span class="helpControlText">Rotate horizontally: Drag</span></li>
<li><i class="fa-solid fa-up-down"></i> <span class="helpControlText">Rotate vertically: Shift+Drag</span></li>
<li><i class="fa-solid fa-up-down-left-right"></i> <span class="helpControlText">Move: Opt/Alt+Drag</span></li>
+ <li><i class="fa-solid fa-share fa-rotate-90"></i> <span class="helpControlText">Jump to: O</span></li>
</ul>
</p>
<form method="dialog">
@@ -513,14 +514,14 @@ function removeSelectedCommand() {
/* 3D & UI */
function initIllo() {
+
window.illo = new Zdog.Illustration({
element: ".zdog-canvas",
scale: 10,
- centered: false,
- translate: { x: 400, y: 400 },
resize: true,
rotate: { x: Zdog.TAU * 0.2 },
});
+
// Wheel (zoom)
window.illo.element.addEventListener("wheel", (e) => {
e.preventDefault();
@@ -535,6 +536,7 @@ function initIllo() {
1 - Math.max(Math.min(e.deltaY / 40, 0.9), -0.9)
);
});
+
// Drag (move)
window.viewRotation = new Zdog.Vector();
new Zdog.Dragger({
@@ -569,6 +571,25 @@ function initIllo() {
},
});
+ // O button (jump to)
+ window.addEventListener("keydown", (event) => {
+ if (event.isComposing || event.key !== "o" || !window.selectedListEntries[0]) {
+ return;
+ }
+ const jumpCmd = window.selectedListEntries[0];
+ if (!"goalx" in jumpCmd || !"goaly" in jumpCmd) {
+ return;
+ }
+ var illoTrans = new Zdog.Vector({
+ x: -jumpCmd.goaly.value * window.illo.scale.x,
+ y: -jumpCmd.goalx.value * window.illo.scale.y,
+ z: -jumpCmd.goalz.value * window.illo.scale.z,
+ });
+ illoTrans.rotate(window.illo.rotate);
+ console.log("jump to X: " + illoTrans.x + ", Y: " + illoTrans.y);
+ window.illo.translate = illoTrans;
+ });
+
window.currentProject.renderAll();
animateIllo();
@@ -740,7 +761,7 @@ function initEditEventListeners() {
}
// Add selection
if (e.target && e.target.matches("li")) {
- window.selectedListEntry = e.target;
+ //window.selectedListEntry = e.target; TEST for removal
e.target.command.addSelection();
window.selectedListEntries.push(e.target.command);
}