From b3c15cff9c3c5109a8bc816bfb22d9c3747e7e67 Mon Sep 17 00:00:00 2001 From: Dr Tracy Gardner Date: Mon, 4 May 2026 10:44:54 +0100 Subject: [PATCH 1/2] Make F-key focus reuse select gizmo mesh selection --- ui/gizmos.js | 59 ++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/ui/gizmos.js b/ui/gizmos.js index 39cff676..3cdbf4f2 100644 --- a/ui/gizmos.js +++ b/ui/gizmos.js @@ -380,6 +380,7 @@ function focusCameraOnMesh() { if (mesh && mesh.name === "ground") mesh = null; } if (!mesh) return; + applyMeshSelection(mesh); mesh.computeWorldMatrix(true); const { min, max } = mesh.getHierarchyBoundingVectors(true); @@ -401,6 +402,36 @@ function focusCameraOnMesh() { camera.setTarget(newTarget); } +function applyMeshSelection(pickedMesh, pickedPoint) { + if (pickedMesh && pickedMesh.name !== "ground") { + if (pickedMesh.parent) { + pickedMesh = getRootMesh(pickedMesh.parent); + pickedMesh.visibility = 0.001; + } + const block = meshMap[pickedMesh?.metadata?.blockKey]; + highlightBlockById(Blockly.getMainWorkspace(), block); + gizmoManager.attachToMesh(pickedMesh); + pickedMesh.showBoundingBox = true; + return; + } + + if (pickedMesh && pickedMesh.name === "ground") { + const roundedPosition = roundVectorToFixed(pickedPoint, 2); + flock.printText({ + text: translate("position_readout").replace( + "{position}", + String(roundedPosition), + ), + duration: 30, + color: "black", + }); + } + if (gizmoManager.attachedMesh) { + resetChildMeshesOfAttachedMesh(); + gizmoManager.attachToMesh(null); + } +} + function viewMeshWithCamera() { let mesh = gizmoManager.attachedMesh; if (mesh && mesh.name === "ground") mesh = null; @@ -1774,34 +1805,8 @@ function handleSelectGizmo() { duration: 30, color: "black", }); - if (flock.meshDebug) console.log(pickedMesh.parent); - if (pickedMesh.parent) { - pickedMesh = getRootMesh(pickedMesh.parent); - if (flock.meshDebug) console.log(pickedMesh.visibility); - pickedMesh.visibility = 0.001; - if (flock.meshDebug) console.log(pickedMesh.visibility); - } - const block = meshMap[pickedMesh?.metadata?.blockKey]; - highlightBlockById(Blockly.getMainWorkspace(), block); - gizmoManager.attachToMesh(pickedMesh); - pickedMesh.showBoundingBox = true; - } else { - if (pickedMesh && pickedMesh.name === "ground") { - const roundedPosition = roundVectorToFixed(pickedPoint, 2); - flock.printText({ - text: translate("position_readout").replace( - "{position}", - String(roundedPosition), - ), - duration: 30, - color: "black", - }); - } - if (gizmoManager.attachedMesh) { - resetChildMeshesOfAttachedMesh(); - gizmoManager.attachToMesh(null); - } } + applyMeshSelection(pickedMesh, pickedPoint); setTimeout(() => { if (!getCanvasCircle()) document.body.style.cursor = "crosshair"; }, 0); From 300b9d7b3aa929fa4541bf0c142b2d0b4776f8ce Mon Sep 17 00:00:00 2001 From: Dr Tracy Gardner Date: Mon, 4 May 2026 10:53:26 +0100 Subject: [PATCH 2/2] Ensure F-focus selection enables mesh bounding box --- ui/gizmos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/gizmos.js b/ui/gizmos.js index 3cdbf4f2..11ba2a75 100644 --- a/ui/gizmos.js +++ b/ui/gizmos.js @@ -411,7 +411,7 @@ function applyMeshSelection(pickedMesh, pickedPoint) { const block = meshMap[pickedMesh?.metadata?.blockKey]; highlightBlockById(Blockly.getMainWorkspace(), block); gizmoManager.attachToMesh(pickedMesh); - pickedMesh.showBoundingBox = true; + enableBoundingBox(pickedMesh); return; }