@floless/app 0.90.3 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +2 -2
- package/dist/web/steel-3d-core.js +48 -0
- package/dist/web/steel-3d-view.js +303 -18
- package/dist/web/steel-editor.html +82 -7
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.
|
|
53109
|
+
define: true ? "0.91.1" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.91.1" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -195,6 +195,54 @@ export function vecToPlane(vec, u, v, n) {
|
|
|
195
195
|
return { du: _dot(vec, u), dv: _dot(vec, v), dn: _dot(vec, n) };
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// --- Local coordinate frame (3D UCS): a FULL 3D basis { origin:[x,y,z]mm, xAxis, yAxis, normal }
|
|
199
|
+
// (orthonormal, right-handed: xAxis × yAxis = normal). The single seam every UCS power routes through.
|
|
200
|
+
// The global identity is { origin:[0,0,0], xAxis:[1,0,0], yAxis:[0,1,0], normal:[0,0,1] } → a no-op.
|
|
201
|
+
// A horizontal "rotate about Z by a" frame is xAxis:[cos,sin,0], yAxis:[−sin,cos,0], normal:[0,0,1];
|
|
202
|
+
// a tilted frame (from a 3-point pick) can point its normal anywhere (see frameFrom3Points).
|
|
203
|
+
/** world point → local: components of (p − origin) along each frame axis = Rᵀ·(p − origin). */
|
|
204
|
+
export function worldToLocal(p, frame) {
|
|
205
|
+
const o = frame.origin, X = frame.xAxis, Y = frame.yAxis, Z = frame.normal;
|
|
206
|
+
const d = [p[0] - o[0], p[1] - o[1], p[2] - o[2]];
|
|
207
|
+
return [nz(_dot(d, X)), nz(_dot(d, Y)), nz(_dot(d, Z))];
|
|
208
|
+
}
|
|
209
|
+
/** local point → world: origin + lx·X + ly·Y + lz·Z. Inverse of worldToLocal. */
|
|
210
|
+
export function localToWorld(l, frame) {
|
|
211
|
+
const o = frame.origin, X = frame.xAxis, Y = frame.yAxis, Z = frame.normal;
|
|
212
|
+
return [nz(o[0] + l[0] * X[0] + l[1] * Y[0] + l[2] * Z[0]),
|
|
213
|
+
nz(o[1] + l[0] * X[1] + l[1] * Y[1] + l[2] * Z[1]),
|
|
214
|
+
nz(o[2] + l[0] * X[2] + l[1] * Y[2] + l[2] * Z[2])];
|
|
215
|
+
}
|
|
216
|
+
/** local VECTOR → world (rotation only, NO origin translation — for relative typed entry / offsets). */
|
|
217
|
+
export function localVectorToWorld(v, frame) {
|
|
218
|
+
const X = frame.xAxis, Y = frame.yAxis, Z = frame.normal;
|
|
219
|
+
return [nz(v[0] * X[0] + v[1] * Y[0] + v[2] * Z[0]),
|
|
220
|
+
nz(v[0] * X[1] + v[1] * Y[1] + v[2] * Z[1]),
|
|
221
|
+
nz(v[0] * X[2] + v[1] * Y[2] + v[2] * Z[2])];
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Full 3D UCS from 3 picked points (CAD 3-point flow): origin=a, +X toward b, +Y toward the c-side
|
|
225
|
+
* (the component of c−a ⊥ X), normal = X × Y. Which side c is picked flips the normal (± Z). Returns
|
|
226
|
+
* an orthonormal right-handed { origin, xAxis, yAxis, normal }, or null when degenerate (a≈b, or c
|
|
227
|
+
* on the X line). Reuses planeFrom3Points (origin/xAxis/normal) and derives yAxis = normal × xAxis.
|
|
228
|
+
*/
|
|
229
|
+
export function frameFrom3Points(a, b, c) {
|
|
230
|
+
const p = planeFrom3Points(a, b, c);
|
|
231
|
+
if (!p) return null;
|
|
232
|
+
const yAxis = _norm(_cross(p.normal, p.xAxis)); // Y = Z × X → ⊥ X, on c's side, right-handed
|
|
233
|
+
if (!yAxis) return null;
|
|
234
|
+
return { origin: p.origin, xAxis: p.xAxis, yAxis, normal: p.normal };
|
|
235
|
+
}
|
|
236
|
+
/** The global identity frame (a no-op UCS). */
|
|
237
|
+
export function identityFrame(origin = [0, 0, 0]) {
|
|
238
|
+
return { origin: [origin[0], origin[1], origin[2]], xAxis: [1, 0, 0], yAxis: [0, 1, 0], normal: [0, 0, 1] };
|
|
239
|
+
}
|
|
240
|
+
/** A horizontal "rotate about Z by angleRad" frame at origin — the common non-tilted case. */
|
|
241
|
+
export function frameFromAngle(origin, angleRad) {
|
|
242
|
+
const c = Math.cos(angleRad), s = Math.sin(angleRad);
|
|
243
|
+
return { origin: [origin[0], origin[1], origin[2]], xAxis: [c, s, 0], yAxis: [-s, c, 0], normal: [0, 0, 1] };
|
|
244
|
+
}
|
|
245
|
+
|
|
198
246
|
/**
|
|
199
247
|
* 3D dimension geometry (pure). a,b are scene mm [x,y,z]. axis ∈ free|x|y|z.
|
|
200
248
|
* free → the straight segment a→b (valueMm = full 3D distance); x|y|z →
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as THREE from 'three';
|
|
18
18
|
import { OrbitControls } from 'three/addons/OrbitControls.js';
|
|
19
19
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
20
|
-
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, planeBasis,
|
|
20
|
+
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, planeBasis, planeFrom3Points, vecToPlane, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame } from './steel-3d-core.js';
|
|
21
21
|
import { gridGeometry, gridCandidates3d, mmPerPx } from './grid-core.js';
|
|
22
22
|
|
|
23
23
|
let renderer, scene, perspCam, orthoCam, camera, controls, root, api, canvasEl, ro, rafId, grid, raycaster, downXY, lastPick = '(none)';
|
|
@@ -155,7 +155,12 @@ function init(canvas, theApi) {
|
|
|
155
155
|
readout.style.cssText = 'position:fixed;display:none;pointer-events:none;z-index:60;background:var(--panel,#0f172a);color:var(--text,#f8fafc);border:1px solid var(--line,#1e293b);border-radius:4px;padding:3px 7px;font:12px system-ui;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,.5)';
|
|
156
156
|
readout._dist = document.createElement('span');
|
|
157
157
|
readout._type = document.createElement('span'); readout._type.style.color = 'var(--mut,#94a3b8)';
|
|
158
|
-
|
|
158
|
+
// UCS Stage 2 — live local-coordinate row (X′/Y′/Z′): a block row that wraps below the length line;
|
|
159
|
+
// persistent label+value nodes updated per hover frame (textContent, never innerHTML). Hidden until fed.
|
|
160
|
+
readout._coord = document.createElement('div'); readout._coord.className = 'ro-coord'; readout._coord.style.display = 'none';
|
|
161
|
+
readout._coordL = []; readout._coordV = [];
|
|
162
|
+
for (let i = 0; i < 3; i++) { const lbl = document.createElement('span'); lbl.className = 'ro-lbl'; const val = document.createElement('b'); readout._coord.append(lbl, val); readout._coordL.push(lbl); readout._coordV.push(val); }
|
|
163
|
+
readout.append(readout._dist, readout._type, readout._coord);
|
|
159
164
|
document.body.appendChild(readout);
|
|
160
165
|
// 3D dimension tool: a group of placed-dim lines (over the steel) + a live preview line + an HTML
|
|
161
166
|
// overlay host for the midpoint labels (positioned each frame so they face the camera as screen text).
|
|
@@ -216,6 +221,7 @@ function loop() {
|
|
|
216
221
|
controls.update();
|
|
217
222
|
sizeEndpoints();
|
|
218
223
|
sizeClipHandles();
|
|
224
|
+
sizeFrameHandle();
|
|
219
225
|
positionDimLabels();
|
|
220
226
|
positionOverlayLabels();
|
|
221
227
|
positionMemberLabels();
|
|
@@ -656,7 +662,7 @@ function setRefLine(on) { refLineOn = !!on; buildRefLines(); }
|
|
|
656
662
|
function setInsertMode(on, pending) {
|
|
657
663
|
insertMode = !!on;
|
|
658
664
|
insertPending = insertMode ? (pending || insertPending) : null;
|
|
659
|
-
if (insertMode) { if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); setClipMode(null); }
|
|
665
|
+
if (insertMode) { if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); setClipMode(null); disarmFrame3d(); }
|
|
660
666
|
if (canvasEl) canvasEl.style.cursor = insertMode ? 'crosshair' : 'default';
|
|
661
667
|
if (api && api.onInsertModeChange) api.onInsertModeChange(insertMode);
|
|
662
668
|
}
|
|
@@ -1192,7 +1198,7 @@ function rebuildClipPlanes(c) { // recompute a clip's .planes from its ed
|
|
|
1192
1198
|
}
|
|
1193
1199
|
function setClipMode(m) { // arm/disarm a clip pick: 'plane' (click a face) | 'box' (draw 2 corners) | null
|
|
1194
1200
|
if (m && dimMode3d) toggleDimTool();
|
|
1195
|
-
if (m) { if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); } // clip shares the left-click — disarm Move/Copy + Add so their picks don't steal it (onDown routes them first)
|
|
1201
|
+
if (m) { if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); disarmFrame3d(); } // clip shares the left-click — disarm Move/Copy + Add + the local frame so their picks don't steal it (onDown routes them first)
|
|
1196
1202
|
clipMode = (m === 'plane' || m === 'box') ? m : null;
|
|
1197
1203
|
clipBoxDraft = null; setClipPreview(null);
|
|
1198
1204
|
if (canvasEl) canvasEl.style.cursor = clipMode ? 'crosshair' : 'default';
|
|
@@ -1548,6 +1554,8 @@ function onKey(e) {
|
|
|
1548
1554
|
if (!renderer || !canvasEl || canvasEl.style.display === 'none') return; // only when 3D is active
|
|
1549
1555
|
const ae = document.activeElement; if (ae && /^(INPUT|SELECT|TEXTAREA)$/.test(ae.tagName)) return;
|
|
1550
1556
|
if (pending && pending.clipDrag && e.key === 'Escape') { e.preventDefault(); const p = pending; if (p.plane) p.clip.point = p.prePoint; else p.clip.box.copy(p.preBox); rebuildClipPlanes(p.clip); applyClips(); renderClipGizmo(); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; return; } // Esc mid-drag → undo the handle move
|
|
1557
|
+
if (framePicking() && e.key === 'Escape') { e.preventDefault(); if (frame3d) { cancelFramePick(); fireFrameChange(); } else armFrame3d(false); return; } // Esc cancels the whole 3-click pick (discards partial clicks); no prior frame → also exit the tool
|
|
1558
|
+
if (pending && pending.frameDrag && e.key === 'Escape') { e.preventDefault(); if (frame3d && pending.preFrame) frame3d = cloneFrame(pending.preFrame); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; fireFrameChange(); return; } // Esc mid-drag → revert the frame to its pre-drag basis
|
|
1551
1559
|
if (pending && e.key === 'Escape' && (pending.epDrag || pending.origMm)) { // Esc mid-drag → cancel a member move / endpoint stretch and revert to the pre-drag state (no commit)
|
|
1552
1560
|
e.preventDefault();
|
|
1553
1561
|
if (pending.mesh && pending.meshPos0) pending.mesh.position.copy(pending.meshPos0); // put a live-moved (or Alt-vertical) member mesh back
|
|
@@ -1586,7 +1594,7 @@ function onKey(e) {
|
|
|
1586
1594
|
function toggleDimTool() {
|
|
1587
1595
|
dimMode3d = !dimMode3d;
|
|
1588
1596
|
if (!dimMode3d) { dimDraft3d = null; dimCandidates3d = null; dimPreviewLine.visible = false; marker.visible = false; readout.style.display = 'none'; canvasEl.style.cursor = 'default'; setSnapOnly3d(null); } // disarming ends the operation → the snap override reverts to all snaps
|
|
1589
|
-
else { if (clipMode) setClipMode(null); if (wpMode) armWorkPlanePick(wpMode); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); drClear3d(); controls.enabled = true; canvasEl.style.cursor = 'crosshair'; } // arming the dim tool disarms the clip pick, a set-plane pick, Move/Copy
|
|
1597
|
+
else { if (clipMode) setClipMode(null); if (wpMode) armWorkPlanePick(wpMode); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); drClear3d(); disarmFrame3d(); controls.enabled = true; canvasEl.style.cursor = 'crosshair'; } // arming the dim tool disarms the clip pick, a set-plane pick, Move/Copy, Add-member AND the local frame (all share the left-click + Esc)
|
|
1590
1598
|
reflectDimBar();
|
|
1591
1599
|
return dimMode3d;
|
|
1592
1600
|
}
|
|
@@ -2242,18 +2250,245 @@ let wpMode = null; // 'face' | '3pt' — armed set-plane pick mode
|
|
|
2242
2250
|
let wpDraft = null; // 3pt picks collected so far
|
|
2243
2251
|
let wpVisible = true; // "Show plane" toggle (applies to an explicit plane)
|
|
2244
2252
|
let wpGroup = null;
|
|
2245
|
-
|
|
2253
|
+
// ---- 3D local drawing frame (UCS, stage 1): a SEPARATE rotate-about-Z frame for skewed framing.
|
|
2254
|
+
// NOT the workPlane — an explicit ◇ Plane wins over it. null = global (world identity). Session-only,
|
|
2255
|
+
// model-wide, never saved to the contract (the frame is a temporary aid; dims it authors persist, not it).
|
|
2256
|
+
// The 3D local frame is a FULL 3D UCS — an orthonormal right-handed basis { origin, xAxis, yAxis, normal }
|
|
2257
|
+
// (a tilted frame is allowed; set by a 3-click pick). A horizontal frame has normal ≈ ±Z. The single seam
|
|
2258
|
+
// (worldToLocal/localToWorld) + every re-aiming tool routes through this via effectiveWP()→planeBasis.
|
|
2259
|
+
let frame3d = null; // { origin:[x,y,z]mm, xAxis, yAxis, normal } | null
|
|
2260
|
+
let frameMode = false; // armed: the gizmo handles are grabbable (else the gizmo is a passive indicator)
|
|
2261
|
+
let framePickPts = null; // null = not picking; [] / [origin] / [origin,xPt] = collecting the 3-click set (frame3d untouched until the 3rd click commits)
|
|
2262
|
+
let framePreview = null; // THREE.Group: the live X/Y rubber-band + Z-flip arrow during a pick
|
|
2263
|
+
const cloneFrame = (f) => ({ origin: [...f.origin], xAxis: [...f.xAxis], yAxis: [...f.yAxis], normal: [...f.normal] });
|
|
2264
|
+
const _dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
2265
|
+
function frameZ() { return frame3d ? frame3d.origin[2] : (api ? api.defaultTosMm() : 0); }
|
|
2266
|
+
function effectiveWP() {
|
|
2267
|
+
if (workPlane) return workPlane; // explicit ◇ Plane wins (unchanged)
|
|
2268
|
+
if (frame3d) return { origin: [...frame3d.origin], normal: [...frame3d.normal], xAxis: [...frame3d.xAxis], kind: 'frame' };
|
|
2269
|
+
return { origin: [0, 0, api ? api.defaultTosMm() : 0], normal: [0, 0, 1], xAxis: [1, 0, 0] };
|
|
2270
|
+
}
|
|
2271
|
+
// What the tools ACTUALLY follow — a set ◇ Plane shadows the local frame, so the chip never claims Local
|
|
2272
|
+
// while a plane overrides it. Editor's Axes chip reads this in 3D. A horizontal frame reports its in-plane
|
|
2273
|
+
// angle; a tilted frame reports its tilt (normal off-vertical) — a single angle can't describe a 3D orientation.
|
|
2274
|
+
function frameInfo() {
|
|
2275
|
+
if (workPlane) return { mode: 'plane', kind: workPlane.kind || null };
|
|
2276
|
+
if (frame3d) {
|
|
2277
|
+
const n = frame3d.normal, horizontal = Math.abs(n[2]) > 0.9999;
|
|
2278
|
+
const angleDeg = horizontal ? Math.atan2(frame3d.xAxis[1], frame3d.xAxis[0]) * 180 / Math.PI : null;
|
|
2279
|
+
const tiltDeg = Math.acos(Math.max(-1, Math.min(1, Math.abs(n[2])))) * 180 / Math.PI; // 0 = horizontal
|
|
2280
|
+
return { mode: 'local', origin: [...frame3d.origin], xAxis: [...frame3d.xAxis], yAxis: [...frame3d.yAxis], normal: [...n], horizontal, angleDeg, tiltDeg, zUp: n[2] >= 0 };
|
|
2281
|
+
}
|
|
2282
|
+
return { mode: 'global' };
|
|
2283
|
+
}
|
|
2284
|
+
function fireFrameChange() { renderFrameGizmo(); if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); }
|
|
2285
|
+
// Set a HORIZONTAL frame at origin (numeric entry + gizmo materialize). origin defaults its Z to the active level.
|
|
2286
|
+
function setFrame3d(originMm, angleDeg) {
|
|
2287
|
+
const z = (originMm && originMm.length > 2) ? originMm[2] : frameZ();
|
|
2288
|
+
frame3d = frameFromAngle(originMm ? [originMm[0], originMm[1], z] : [0, 0, z], (angleDeg || 0) * Math.PI / 180);
|
|
2289
|
+
fireFrameChange();
|
|
2290
|
+
}
|
|
2291
|
+
// Set a full (possibly tilted) UCS from a computed basis — the 3-click pick's output.
|
|
2292
|
+
function setFrameBasis(basis) { frame3d = cloneFrame(basis); fireFrameChange(); }
|
|
2293
|
+
// Numeric "Angle°" sets a HORIZONTAL frame at that in-plane angle (keeps origin) — the horizontal refine case.
|
|
2294
|
+
function setFrameAngle(angleDeg) { setFrame3d(frame3d ? frame3d.origin : [0, 0, api ? api.defaultTosMm() : 0], angleDeg); }
|
|
2295
|
+
function setFrameOrigin(originMm) { // translate origin, keep the basis orientation
|
|
2296
|
+
if (!frame3d) { setFrame3d(originMm, 0); return; }
|
|
2297
|
+
frame3d.origin = [originMm[0], originMm[1], originMm.length > 2 ? originMm[2] : frame3d.origin[2]];
|
|
2298
|
+
fireFrameChange();
|
|
2299
|
+
}
|
|
2300
|
+
function clearFrame3d() { const had = !!frame3d || frameMode; cancelFramePick(); frame3d = null; frameMode = false; if (had) fireFrameChange(); }
|
|
2301
|
+
function armFrame3d(on) { // arm/disarm the tool; arming disarms conflicting tools
|
|
2302
|
+
frameMode = on == null ? !frameMode : !!on;
|
|
2303
|
+
if (frameMode) {
|
|
2304
|
+
if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); if (wpMode) { wpMode = null; wpDraft = null; reflectWpBar(); } setClipMode(null); setInsertMode(false); // arming the frame disarms EVERY other left-click 3D tool (incl. clip + insert)
|
|
2305
|
+
framePickPts = frame3d ? null : []; // no frame yet → start the 3-click pick; an existing frame → straight to drag-refine (re-pick from the panel)
|
|
2306
|
+
disposeFramePreview();
|
|
2307
|
+
} else cancelFramePick();
|
|
2308
|
+
if (canvasEl) canvasEl.style.cursor = frameMode ? 'crosshair' : 'default';
|
|
2309
|
+
fireFrameChange();
|
|
2310
|
+
}
|
|
2311
|
+
// re-run the 3-click pick on an already-armed frame (the panel "Re-pick" action) — keeps the old frame visible until commit
|
|
2312
|
+
function repickFrame3d() { if (frameMode) { framePickPts = []; disposeFramePreview(); fireFrameChange(); } }
|
|
2313
|
+
// disarm the frame tool — called by every OTHER left-click 3D tool when it arms, so the frame can't stay armed behind it and silently swallow clicks (Codex/silent-failure MED-2)
|
|
2314
|
+
function disarmFrame3d() { if (frameMode || framePicking()) { cancelFramePick(); frameMode = false; if (canvasEl) canvasEl.style.cursor = 'default'; fireFrameChange(); } }
|
|
2315
|
+
// The frame gizmo: an X–Y plane patch + red-X / green-Y / blue-Z axes at the (draggable) origin, ALWAYS
|
|
2316
|
+
// visible (at global 0,0 identity when no frame is set), armed → grabbable handles + rotation ring. In
|
|
2317
|
+
// overlayScene (2nd unclipped pass) so a section plane never cuts it. A set ◇ Plane shadows it (its own patch shows).
|
|
2318
|
+
let frameGizmo = null;
|
|
2319
|
+
function disposeFrameGizmo() { if (!frameGizmo) return; if (overlayScene) overlayScene.remove(frameGizmo); frameGizmo.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); frameGizmo = null; }
|
|
2320
|
+
function renderFrameGizmo() {
|
|
2321
|
+
disposeFrameGizmo();
|
|
2322
|
+
if (!overlayScene || workPlane) return; // ◇ Plane shadows the frame → renderWorkPlane draws instead
|
|
2323
|
+
const act = !!frame3d, on = frameMode;
|
|
2324
|
+
const O = frame3d ? frame3d.origin : [0, 0, api ? api.defaultTosMm() : 0];
|
|
2325
|
+
const u = new THREE.Vector3(...(frame3d ? frame3d.xAxis : [1, 0, 0])), v = new THREE.Vector3(...(frame3d ? frame3d.yAxis : [0, 1, 0])), n = new THREE.Vector3(...(frame3d ? frame3d.normal : [0, 0, 1])); // the real basis (tilted-aware)
|
|
2326
|
+
const g = new THREE.Group();
|
|
2327
|
+
const CELL = 1524, N = 4, half = (CELL * N) / 2; // a small 4×4 @ 5ft patch (drawn in local coords, group oriented below)
|
|
2328
|
+
const verts = []; for (let i = 0; i <= N; i++) { const o = -half + i * CELL; verts.push(o, -half, 0, o, half, 0, -half, o, 0, half, o, 0); }
|
|
2329
|
+
const grid = new THREE.BufferGeometry(); grid.setAttribute('position', new THREE.Float32BufferAttribute(verts, 3));
|
|
2330
|
+
g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.3 : 0.14 })));
|
|
2331
|
+
g.add(new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.1 : 0.05, side: THREE.DoubleSide, depthWrite: false })));
|
|
2332
|
+
const axis = (len, col, vx, vy, vz) => { const l = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(vx * len, vy * len, vz * len)]), new THREE.LineBasicMaterial({ color: col, transparent: true, opacity: 0.95 })); l.renderOrder = 997; return l; };
|
|
2333
|
+
g.add(axis(half, 0xef4444, 1, 0, 0)); // local X = red
|
|
2334
|
+
g.add(axis(half, 0x22c55e, 0, 1, 0)); // local Y = green
|
|
2335
|
+
g.add(axis(half * 0.9, 0x3b82f6, 0, 0, 1)); // local Z = blue (up)
|
|
2336
|
+
const od = new THREE.Mesh(new THREE.SphereGeometry(1, 12, 8), new THREE.MeshBasicMaterial({ color: on ? 0xf59e0b : 0x3b82f6 })); // unit sphere → sizeFrameHandle() keeps it screen-constant (like the endpoint/clip dots); armed = amber #f59e0b (distinct from the warm-yellow endpoint dots), passive = brand blue
|
|
2337
|
+
od.userData.frameHandle = 'origin'; g.add(od);
|
|
2338
|
+
if (on) { // armed → the cyan rotation ring (grabbable)
|
|
2339
|
+
const pts = []; for (let i = 0; i <= 48; i++) { const p = i / 48 * Math.PI * 2; pts.push(new THREE.Vector3(Math.cos(p) * half * 0.8, Math.sin(p) * half * 0.8, 0)); }
|
|
2340
|
+
const ring = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(pts), new THREE.LineBasicMaterial({ color: 0x22d3ee, transparent: true, opacity: 0.85 }));
|
|
2341
|
+
ring.renderOrder = 997; ring.userData.frameHandle = 'ring'; g.add(ring);
|
|
2342
|
+
}
|
|
2343
|
+
g.applyMatrix4(new THREE.Matrix4().makeBasis(u, v, n));
|
|
2344
|
+
g.position.set(O[0], O[1], O[2]);
|
|
2345
|
+
frameGizmo = g; overlayScene.add(g); sizeFrameHandle();
|
|
2346
|
+
}
|
|
2347
|
+
// Screen-constant origin dot — mirrors sizeClipHandles(); called each frame from loop() so the grab dot
|
|
2348
|
+
// stays ~14px armed / ~11px passive at any zoom (the cyan ring + patch stay world-sized as large affordances).
|
|
2349
|
+
function sizeFrameHandle() {
|
|
2350
|
+
if (!frameGizmo) return;
|
|
2351
|
+
const O = frameGizmoOrigin(), wp = new THREE.Vector3(O[0], O[1], O[2]), r = pxToWorldAt(frameMode ? 7 : 5.5, wp);
|
|
2352
|
+
for (const h of frameGizmo.children) if (h.userData && h.userData.frameHandle === 'origin') h.scale.setScalar(r);
|
|
2353
|
+
}
|
|
2354
|
+
// --- frame manipulator: grab + drag the gizmo's origin (translate) or ring (rotate about Z). Armed only. ---
|
|
2355
|
+
const FRAME_RING_R = (1524 * 4 / 2) * 0.8; // ring radius (matches renderFrameGizmo)
|
|
2356
|
+
function frameGizmoOrigin() { return frame3d ? frame3d.origin : [0, 0, api ? api.defaultTosMm() : 0]; }
|
|
2357
|
+
function pickFrameHandle(cx, cy) { // → 'origin' | 'ring' | null (screen-space, like pickClipHandle)
|
|
2358
|
+
if (!frameMode || !overlayScene || workPlane || !canvasEl) return null;
|
|
2359
|
+
camera.updateMatrixWorld();
|
|
2360
|
+
const rect = canvasEl.getBoundingClientRect(), px = cx - rect.left, py = cy - rect.top;
|
|
2361
|
+
const O = frameGizmoOrigin();
|
|
2362
|
+
const toS = (p) => { const w = new THREE.Vector3(p[0], p[1], p[2]).project(camera); return w.z > 1 ? null : [(w.x * 0.5 + 0.5) * rect.width, (-w.y * 0.5 + 0.5) * rect.height]; };
|
|
2363
|
+
const os = toS(O); if (os && Math.hypot(os[0] - px, os[1] - py) <= 16) return 'origin';
|
|
2364
|
+
const u = frame3d ? frame3d.xAxis : [1, 0, 0], v = frame3d ? frame3d.yAxis : [0, 1, 0]; let bestD = 12; // ring lies in the frame's X-Y plane — sample all THREE coords so a tilted ring's grab matches the drawn ring
|
|
2365
|
+
for (let i = 0; i < 48; i++) { const ph = i / 48 * Math.PI * 2, c = Math.cos(ph), s = Math.sin(ph);
|
|
2366
|
+
const ss = toS([O[0] + FRAME_RING_R * (c * u[0] + s * v[0]), O[1] + FRAME_RING_R * (c * u[1] + s * v[1]), O[2] + FRAME_RING_R * (c * u[2] + s * v[2])]);
|
|
2367
|
+
if (ss) { const dd = Math.hypot(ss[0] - px, ss[1] - py); if (dd < bestD) bestD = dd; } }
|
|
2368
|
+
return bestD < 12 ? 'ring' : null;
|
|
2369
|
+
}
|
|
2370
|
+
function startFrameDrag(kind, e) {
|
|
2371
|
+
const O = frameGizmoOrigin();
|
|
2372
|
+
if (!frame3d) setFrame3d([O[0], O[1], O[2]], 0); // materialize a horizontal frame on first grab from global
|
|
2373
|
+
pending = { frameDrag: kind, preFrame: cloneFrame(frame3d) };
|
|
2374
|
+
if (kind === 'ring') { // capture the in-plane angle at the grab point so the rotation is RELATIVE (grabbing at 90° doesn't jump the frame 90°)
|
|
2375
|
+
const hit = rayToFramePlane(e.clientX, e.clientY, frame3d.origin, frame3d.normal);
|
|
2376
|
+
const d = hit ? [hit[0] - frame3d.origin[0], hit[1] - frame3d.origin[1], hit[2] - frame3d.origin[2]] : null;
|
|
2377
|
+
pending.startAngle = d ? Math.atan2(_dot3(d, frame3d.yAxis), _dot3(d, frame3d.xAxis)) : null; // edge-on grab → null; onMoveFrame sets the reference on the first valid hit (no jump)
|
|
2378
|
+
}
|
|
2379
|
+
dragging = null; downXY = [e.clientX, e.clientY];
|
|
2380
|
+
}
|
|
2381
|
+
// camera ray → intersection with the arbitrary plane (origin, normal); null when the ray is ∥ the plane (edge-on)
|
|
2382
|
+
function rayToFramePlane(cx, cy, origin, normal) {
|
|
2383
|
+
if (!canvasEl) return null;
|
|
2384
|
+
const rect = canvasEl.getBoundingClientRect();
|
|
2385
|
+
const ndc = new THREE.Vector2(((cx - rect.left) / rect.width) * 2 - 1, -((cy - rect.top) / rect.height) * 2 + 1);
|
|
2386
|
+
const rc = new THREE.Raycaster(); rc.setFromCamera(ndc, camera);
|
|
2387
|
+
const nrm = new THREE.Vector3(normal[0], normal[1], normal[2]);
|
|
2388
|
+
if (Math.abs(rc.ray.direction.dot(nrm)) < 1e-3) return null; // ray ∥ the plane (edge-on) → no reliable intersection (would be astronomically far → a false rotation delta)
|
|
2389
|
+
const plane = new THREE.Plane(nrm, -(normal[0] * origin[0] + normal[1] * origin[1] + normal[2] * origin[2]));
|
|
2390
|
+
const pt = new THREE.Vector3();
|
|
2391
|
+
return rc.ray.intersectPlane(plane, pt) ? [pt.x, pt.y, pt.z] : null;
|
|
2392
|
+
}
|
|
2393
|
+
function onMoveFrame(e) {
|
|
2394
|
+
if (!dragging && Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) <= DRAG_TOL_PX) return;
|
|
2395
|
+
dragging = pending;
|
|
2396
|
+
const pre = pending.preFrame;
|
|
2397
|
+
const showRO = (dist, type) => { if (readout) { readout._dist.textContent = dist; readout._type.textContent = type; readout.style.left = (e.clientX + 14) + 'px'; readout.style.top = (e.clientY + 14) + 'px'; readout.style.display = 'block'; } };
|
|
2398
|
+
if (pending.frameDrag === 'origin') { // translate the origin — snaps to geometry like any point pick; Shift = ortho lock; Alt = no snap (basis orientation kept)
|
|
2399
|
+
let target = null;
|
|
2400
|
+
if (!e.shiftKey && !e.altKey) { const sn = dimPointAt(e); if (sn && sn.type) { target = sn.p; showMarker(sn.p, sn.type); } } // snapped to a real member end / grid / intersection → land on the true 3D point
|
|
2401
|
+
if (!target) {
|
|
2402
|
+
const hit = rayToPlane(e.clientX, e.clientY, pre.origin[2]); // free move on the plane at the origin's Z; edge-on view → null → skip (no NaN)
|
|
2403
|
+
if (!hit) { showRO('rotate to an angled or top view', ''); return; }
|
|
2404
|
+
let x = hit[0], y = hit[1];
|
|
2405
|
+
if (e.shiftKey) { const dx = x - pre.origin[0], dy = y - pre.origin[1]; if (Math.abs(dx) >= Math.abs(dy)) y = pre.origin[1]; else x = pre.origin[0]; } // Shift = ortho lock (H/V) from the pre-drag origin, like dragging a member
|
|
2406
|
+
target = [x, y, pre.origin[2]]; if (marker) marker.visible = false;
|
|
2407
|
+
}
|
|
2408
|
+
frame3d.origin = target;
|
|
2409
|
+
showRO((Math.hypot(target[0] - pre.origin[0], target[1] - pre.origin[1], target[2] - pre.origin[2]) / FT_MM).toFixed(2) + ' ft', ' moved');
|
|
2410
|
+
} else { // ring → rotate the basis about its OWN normal (tilt preserved)
|
|
2411
|
+
const hit = rayToFramePlane(e.clientX, e.clientY, pre.origin, pre.normal);
|
|
2412
|
+
if (!hit) { showRO('rotate to an angled or top view', ''); return; }
|
|
2413
|
+
const d = [hit[0] - pre.origin[0], hit[1] - pre.origin[1], hit[2] - pre.origin[2]];
|
|
2414
|
+
const cur = Math.atan2(_dot3(d, pre.yAxis), _dot3(d, pre.xAxis));
|
|
2415
|
+
if (pending.startAngle == null) { pending.startAngle = cur; return; } // grab was edge-on → set the reference on the FIRST valid hit, don't rotate this frame (Codex)
|
|
2416
|
+
const ang = cur - pending.startAngle, c = Math.cos(ang), s = Math.sin(ang); // RELATIVE to the grab point: rotate by the delta, not the absolute cursor angle
|
|
2417
|
+
frame3d = { origin: [...pre.origin], normal: [...pre.normal],
|
|
2418
|
+
xAxis: [c * pre.xAxis[0] + s * pre.yAxis[0], c * pre.xAxis[1] + s * pre.yAxis[1], c * pre.xAxis[2] + s * pre.yAxis[2]],
|
|
2419
|
+
yAxis: [-s * pre.xAxis[0] + c * pre.yAxis[0], -s * pre.xAxis[1] + c * pre.yAxis[1], -s * pre.xAxis[2] + c * pre.yAxis[2]] };
|
|
2420
|
+
showRO(Math.round(ang * 180 / Math.PI) + '°', ' rot');
|
|
2421
|
+
}
|
|
2422
|
+
fireFrameChange();
|
|
2423
|
+
}
|
|
2424
|
+
// test helper: the frame gizmo's grab points projected to client px (origin + two ring samples), so an E2E can drive precise drags
|
|
2425
|
+
function frameHandlesScreen() {
|
|
2426
|
+
if (!canvasEl) return null;
|
|
2427
|
+
camera.updateMatrixWorld();
|
|
2428
|
+
const rect = canvasEl.getBoundingClientRect(), O = frameGizmoOrigin();
|
|
2429
|
+
const toS = (p) => { const w = new THREE.Vector3(p[0], p[1], p[2]).project(camera); return { x: rect.left + (w.x * 0.5 + 0.5) * rect.width, y: rect.top + (-w.y * 0.5 + 0.5) * rect.height, behind: w.z > 1 }; };
|
|
2430
|
+
const u = frame3d ? frame3d.xAxis : [1, 0, 0], v = frame3d ? frame3d.yAxis : [0, 1, 0];
|
|
2431
|
+
const ringAt = (deg) => { const ph = deg * Math.PI / 180, c = Math.cos(ph), s = Math.sin(ph); return toS([O[0] + FRAME_RING_R * (c * u[0] + s * v[0]), O[1] + FRAME_RING_R * (c * u[1] + s * v[1]), O[2] + FRAME_RING_R * (c * u[2] + s * v[2])]); }; // all 3 coords → matches the drawn tilted ring
|
|
2432
|
+
return { origin: toS(O), ring0: ringAt(0), ring90: ringAt(90), armed: frameMode };
|
|
2433
|
+
}
|
|
2434
|
+
// --- 3-click UCS set (D6): pick origin → X-axis point → Y-side point → frameFrom3Points → a full (possibly
|
|
2435
|
+
// tilted) basis. Each click snaps freely to member ends / grid / geometry (dimPointAt = D5, works from any
|
|
2436
|
+
// camera angle). frame3d is untouched until the 3rd click commits, so the chip + prior gizmo don't flicker. ---
|
|
2437
|
+
function framePicking() { return framePickPts !== null; }
|
|
2438
|
+
function framePickStep() { return framePickPts ? framePickPts.length : null; } // 0=origin · 1=X · 2=Y | null when not picking
|
|
2439
|
+
function cancelFramePick() { framePickPts = null; disposeFramePreview(); if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; }
|
|
2440
|
+
function disposeFramePreview() { if (!framePreview) return; if (overlayScene) overlayScene.remove(framePreview); framePreview.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); framePreview = null; }
|
|
2441
|
+
function fireFramePickChange() { if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); } // the panel hint follows the pick step; frame3d is unchanged so the chip/gizmo stay put
|
|
2442
|
+
function framePickClick(e) {
|
|
2443
|
+
const r = dimPointAt(e); if (!r) return; // a valid snapped/plane point
|
|
2444
|
+
if (framePickPts.length === 1 && Math.hypot(r.p[0] - framePickPts[0][0], r.p[1] - framePickPts[0][1], r.p[2] - framePickPts[0][2]) < 5) { // X point == origin → there's no X axis; reject HERE with an accurate message (else every later Y pick fails on a≈b)
|
|
2445
|
+
if (api && api.toast) api.toast('That’s the origin — pick a different point to set the X direction'); return; }
|
|
2446
|
+
if (framePickPts.length < 2) { framePickPts.push(r.p); showMarker(r.p, r.type); fireFramePickChange(); return; }
|
|
2447
|
+
const basis = frameFrom3Points(framePickPts[0], framePickPts[1], r.p); // 3rd click → build the UCS
|
|
2448
|
+
if (!basis) { if (api && api.toast) api.toast('That point is in line with the X axis — pick a point off to the side'); return; } // degenerate: keep collecting
|
|
2449
|
+
framePickPts = null; disposeFramePreview(); if (marker) marker.visible = false; if (readout) readout.style.display = 'none';
|
|
2450
|
+
setFrameBasis(basis); // commit → frame3d set, chip/panel update, gizmo redraws; frameMode stays armed for drag-refine
|
|
2451
|
+
}
|
|
2452
|
+
// Live preview: after the origin → the X arm to the cursor; after X → the Y arm + a Z arrow that visibly
|
|
2453
|
+
// flips as the cursor crosses to the other side of X (the D6 "which side sets Z up/down" risk, made visible).
|
|
2454
|
+
function renderFramePickPreview(e) {
|
|
2455
|
+
disposeFramePreview();
|
|
2456
|
+
if (!overlayScene || !framePickPts) return;
|
|
2457
|
+
const r = dimPointAt(e), cur = r ? r.p : null;
|
|
2458
|
+
if (r) showMarker(r.p, r.type); else if (marker) marker.visible = false; // snap reticle on EVERY step, including the origin pick
|
|
2459
|
+
if (cur) roShowCoordOnly(cur, e.clientX, e.clientY); // live coords of the cursor at every frame-set click (origin/X/Y)
|
|
2460
|
+
else if (readout) readout.style.display = 'none'; // cursor resolved to nothing (edge-on/miss) → don't freeze the last coord
|
|
2461
|
+
if (!cur || !framePickPts.length) return; // origin step: just the reticle, no rubber-band yet
|
|
2462
|
+
const g = new THREE.Group();
|
|
2463
|
+
const line = (a, b, col, op) => { const l = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(...a), new THREE.Vector3(...b)]), new THREE.LineBasicMaterial({ color: col, transparent: true, opacity: op == null ? 0.95 : op })); l.material.depthTest = false; l.renderOrder = 998; return l; };
|
|
2464
|
+
const O = framePickPts[0];
|
|
2465
|
+
if (framePickPts.length === 1) { // origin set → preview local X toward the cursor
|
|
2466
|
+
g.add(line(O, cur, 0xef4444));
|
|
2467
|
+
} else { // origin + X set → preview Y + the flipping Z
|
|
2468
|
+
const X = framePickPts[1], basis = frameFrom3Points(O, X, cur);
|
|
2469
|
+
g.add(line(O, X, 0xef4444)); // committed X (red)
|
|
2470
|
+
if (basis) {
|
|
2471
|
+
const half = Math.max(1524, Math.hypot(X[0] - O[0], X[1] - O[1], X[2] - O[2]));
|
|
2472
|
+
g.add(line(O, [O[0] + basis.yAxis[0] * half, O[1] + basis.yAxis[1] * half, O[2] + basis.yAxis[2] * half], 0x22c55e)); // Y (green)
|
|
2473
|
+
g.add(line(O, [O[0] + basis.normal[0] * half * 0.9, O[1] + basis.normal[1] * half * 0.9, O[2] + basis.normal[2] * half * 0.9], 0x3b82f6)); // Z (blue) — flips with the cursor side
|
|
2474
|
+
if (readout) { readout._dist.textContent = basis.normal[2] >= 0 ? 'Z up' : 'Z down'; readout._type.textContent = ''; readout.style.left = (e.clientX + 14) + 'px'; readout.style.top = (e.clientY + 14) + 'px'; readout.style.display = 'block'; }
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
framePreview = g; overlayScene.add(g);
|
|
2478
|
+
}
|
|
2246
2479
|
// F3: lock a plan-space [dx,dy] drag delta to the dominant working-plane axis (Shift = ortho on a direct member drag — move or Ctrl+drag copy).
|
|
2247
|
-
// Reuses
|
|
2248
|
-
//
|
|
2480
|
+
// Reuses effectiveWP() above so a rotated-about-Z local UCS is honoured; a genuinely tilted frame (>~0.8°) falls back to
|
|
2481
|
+
// plan X/Y (whose u/v aren't horizontal) — the horizontal plan drag never gains a Z component.
|
|
2249
2482
|
function orthoLockDelta(dx, dy) {
|
|
2250
2483
|
const wp = effectiveWP();
|
|
2251
|
-
if (Math.abs(wp.normal[2]) < 0.9999) return Math.abs(dx) >= Math.abs(dy) ? [dx, 0] : [0, dy]; //
|
|
2484
|
+
if (Math.abs(wp.normal[2]) < 0.9999) return Math.abs(dx) >= Math.abs(dy) ? [dx, 0] : [0, dy]; // only a horizontal frame (incl. rotated-about-Z) uses u/v; a tilted frame falls back to plan X/Y
|
|
2252
2485
|
const { u, v } = planeBasis(wp.normal, wp.xAxis);
|
|
2253
2486
|
const du = dx * u[0] + dy * u[1], dv = dx * v[0] + dy * v[1];
|
|
2254
2487
|
return Math.abs(du) >= Math.abs(dv) ? [du * u[0], du * u[1]] : [dv * v[0], dv * v[1]];
|
|
2255
2488
|
}
|
|
2256
2489
|
function renderWorkPlane() {
|
|
2490
|
+
renderFrameGizmo(); // keep the frame gizmo in sync with the ◇ Plane (it self-guards on workPlane: hidden while a plane is set, restored when cleared) — Codex/code-review
|
|
2491
|
+
if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); // and refresh the Axes chip: "Plane" when a plane is set, back to Local/Global when cleared
|
|
2257
2492
|
if (wpGroup) { scene.remove(wpGroup); wpGroup.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); wpGroup = null; }
|
|
2258
2493
|
if (!workPlane || !wpVisible) return; // the implicit level plane is not drawn — the 2D plan already communicates it
|
|
2259
2494
|
const wp = effectiveWP(), { u, v } = planeBasis(wp.normal, wp.xAxis);
|
|
@@ -2278,7 +2513,7 @@ function renderWorkPlane() {
|
|
|
2278
2513
|
function reflectWpBar() { const b = document.getElementById('m3dWp'); if (b) { b.classList.toggle('on', !!wpMode || !!workPlane);
|
|
2279
2514
|
const kind = workPlane && workPlane.kind ? { face: 'Face', p3: '3pt', xy: 'XY', xz: 'XZ', yz: 'YZ' }[workPlane.kind] || '' : '';
|
|
2280
2515
|
b.textContent = wpMode ? '◇ Plane ✕' : (kind ? '◇ Plane: ' + kind + ' ▾' : '◇ Plane ▾'); } } // the label reads the active plane without opening the menu (ux review)
|
|
2281
|
-
function armWorkPlanePick(mode) { if (wpMode === mode) { wpMode = null; wpDraft = null; } else { wpMode = mode; wpDraft = null; if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); } marker.visible = false; canvasEl.style.cursor = wpMode ? 'crosshair' : 'default'; reflectWpBar(); } // a set-plane pick shares the left-click — disarm Move/Copy + Add (their onDown routes run first)
|
|
2516
|
+
function armWorkPlanePick(mode) { if (wpMode === mode) { wpMode = null; wpDraft = null; } else { wpMode = mode; wpDraft = null; if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); disarmFrame3d(); } marker.visible = false; canvasEl.style.cursor = wpMode ? 'crosshair' : 'default'; reflectWpBar(); } // a set-plane pick shares the left-click — disarm Move/Copy + Add + the local frame (their onDown routes run first)
|
|
2282
2517
|
function setWorkPlanePrincipal(kind, offsetMm) {
|
|
2283
2518
|
const off = offsetMm || 0;
|
|
2284
2519
|
const def = { xy: { normal: [0, 0, 1], xAxis: [1, 0, 0] }, xz: { normal: [0, 1, 0], xAxis: [1, 0, 0] }, yz: { normal: [1, 0, 0], xAxis: [0, 1, 0] } }[kind];
|
|
@@ -2336,7 +2571,7 @@ function wpPointAt(e) {
|
|
|
2336
2571
|
if (!e.altKey) {
|
|
2337
2572
|
if (!tfCandidates) tfCandidates = allCandidates(null); // members + grid, so Move/Copy + draw-on-plane snap to the grid too
|
|
2338
2573
|
const r = snapPoint(hit, tfCandidates.filter((c) => candAllowed3d(c.type)), toScreen, SNAP_TOL_PX); // honour the running-snaps / override
|
|
2339
|
-
if (r.candidate) return { p:
|
|
2574
|
+
if (r.candidate) return { p: r.snapped, snap: true, type: r.candidate.type }; // land on the TRUE 3D snap (member end / grid), NOT projected onto the plane — snapping stays free to the whole model, same as global (Pawel D5); a free (non-snapped) click still rides the plane below
|
|
2340
2575
|
}
|
|
2341
2576
|
return { p: hit, snap: false, type: null };
|
|
2342
2577
|
}
|
|
@@ -2382,7 +2617,7 @@ function tfGhostBuild(offs) {
|
|
|
2382
2617
|
}
|
|
2383
2618
|
function tfPreview(e) {
|
|
2384
2619
|
const st = cmActive(); if (!st || !tfDraft) return;
|
|
2385
|
-
const r = wpPointAt(e); if (!r) return;
|
|
2620
|
+
const r = wpPointAt(e); if (!r) { if (readout) readout.style.display = 'none'; return; } // cursor off the plane (edge-on) → clear the chip, don't freeze the last readout
|
|
2386
2621
|
const p = tfConstrain(r.p, e);
|
|
2387
2622
|
tfLast = p; tfLastClient = [e.clientX, e.clientY];
|
|
2388
2623
|
if (r.snap && tfAxis === 'free' && !e.shiftKey) showMarker(p, r.type); else marker.visible = false;
|
|
@@ -2400,6 +2635,7 @@ function tfPreview(e) {
|
|
|
2400
2635
|
readout._dist.textContent = api.fmtLen ? api.fmtLen(L) : (L / FT_MM).toFixed(2) + ' ft';
|
|
2401
2636
|
readout._type.textContent = r.snap ? ' · ' + (r.type || 'snap') : (st.tool === 'copy' && !st.array && st.count > 1 ? ' ×' + st.count : '');
|
|
2402
2637
|
readout.style.left = (e.clientX + 14) + 'px'; readout.style.top = (e.clientY + 14) + 'px'; readout.style.display = 'block';
|
|
2638
|
+
roCoords(p); // local coords of the destination point
|
|
2403
2639
|
}
|
|
2404
2640
|
function tfClick(e) {
|
|
2405
2641
|
const st = cmActive(); if (!st) return false;
|
|
@@ -2462,15 +2698,16 @@ function drClick(e) {
|
|
|
2462
2698
|
if (drRubber) drRubber.visible = false; readout.style.display = 'none'; // stays armed for the next member
|
|
2463
2699
|
}
|
|
2464
2700
|
function drPreview(e) {
|
|
2465
|
-
const r = wpPointAt(e); if (!r) return;
|
|
2701
|
+
const r = wpPointAt(e); if (!r) { if (readout) readout.style.display = 'none'; return; } // cursor off the plane (edge-on) → clear the chip, don't freeze the last readout
|
|
2466
2702
|
if (r.snap) showMarker(r.p, r.type); else marker.visible = false;
|
|
2467
|
-
if (!drDraft) {
|
|
2703
|
+
if (!drDraft) { roShowCoordOnly(r.p, e.clientX, e.clientY); return; } // before the start pick: show the start point's local coords
|
|
2468
2704
|
const p = drShiftLock(r.p, e);
|
|
2469
2705
|
if (!drRubber) { drRubber = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(), new THREE.Vector3()]), new THREE.LineBasicMaterial({ color: 0x22d3ee })); drRubber.material.depthTest = false; drRubber.renderOrder = 997; scene.add(drRubber); }
|
|
2470
2706
|
drRubber.geometry.setFromPoints([new THREE.Vector3(...drDraft), new THREE.Vector3(...p)]); drRubber.visible = true;
|
|
2471
2707
|
const L = Math.hypot(p[0] - drDraft[0], p[1] - drDraft[1], p[2] - drDraft[2]);
|
|
2472
2708
|
readout._dist.textContent = api.fmtLen ? api.fmtLen(L) : (L / FT_MM).toFixed(2) + ' ft'; readout._type.textContent = r.snap ? ' · ' + (r.type || 'snap') : '';
|
|
2473
2709
|
readout.style.left = (e.clientX + 14) + 'px'; readout.style.top = (e.clientY + 14) + 'px'; readout.style.display = 'block';
|
|
2710
|
+
roCoords(p); // local coords of the member end point
|
|
2474
2711
|
}
|
|
2475
2712
|
// world units per screen pixel at the target plane — drives screen-CONSTANT marker/dot sizes, for
|
|
2476
2713
|
// BOTH perspective (distance) and ortho (frustum height / zoom), so dots stay small when zoomed in.
|
|
@@ -2564,6 +2801,7 @@ function gridPlaneZ() {
|
|
|
2564
2801
|
function dimEffectiveAxis(alt) { return alt && dimDraft3d ? 'z' : dimAxis3d; }
|
|
2565
2802
|
|
|
2566
2803
|
function onDown(e) {
|
|
2804
|
+
if (readout) { readout.style.display = 'none'; if (readout._coord) readout._coord.style.display = 'none'; } // UCS Stage 2: hide the whole readout chip so a drag never shows a lingering coordinate (or an empty coord-only shell); the drag/next hover re-shows it
|
|
2567
2805
|
if (e.button === 2) { rightDownXY = [e.clientX, e.clientY]; rightMoved = false; } // arm the click-vs-drag test for the snap menu
|
|
2568
2806
|
if (e.button !== 0) return; // RIGHT/MIDDLE → OrbitControls (orbit/pan)
|
|
2569
2807
|
if (wpMode === 'face') { e.stopPropagation(); const r = wpFacePick(e.clientX, e.clientY); if (r) { workPlane = r; wpMode = null; canvasEl.style.cursor = 'default'; renderWorkPlane(); reflectWpBar(); if (api && api.toast) api.toast('Working plane set on the face'); } return; } // armed: one face click sets the plane
|
|
@@ -2583,6 +2821,8 @@ function onDown(e) {
|
|
|
2583
2821
|
if (insertMode) { e.stopPropagation(); const r = insertPick(e.clientX, e.clientY); const sticky = insertPending && insertPending.sticky; if (r && api && api.onInsertPlace) api.onInsertPlace(r, insertPending); if (!sticky) setInsertMode(false); return; } // armed: place at the pick. One-shot for a detail / IFC import; a sticky pending (a favourite) STAYS armed for repeat placement — Esc/onInsertPlace's own cancel disarms.
|
|
2584
2822
|
if (clipMode === 'plane') { e.stopPropagation(); addClipPlaneAtScreen(e.clientX, e.clientY); return; } // armed: left-click a face → place a clip plane (stays armed)
|
|
2585
2823
|
if (clipMode === 'box') { e.stopPropagation(); onClipBoxClick(e); return; } // armed: 2-corner clip-box draw on the floor plane
|
|
2824
|
+
if (framePicking()) { e.stopPropagation(); controls.enabled = true; framePickClick(e); return; } // 3-click UCS set: this click collects the origin / X point / Y point
|
|
2825
|
+
if (frameMode) { let fh = null; try { fh = pickFrameHandle(e.clientX, e.clientY); } catch { fh = null; } if (fh) { e.stopPropagation(); controls.enabled = false; startFrameDrag(fh, e); return; } } // grab the local-frame origin/ring (armed) → drag it; an empty click falls through (orbit)
|
|
2586
2826
|
if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(e.clientX, e.clientY); } catch { ch = null; } if (ch) { e.stopPropagation(); controls.enabled = false; downXY = [e.clientX, e.clientY]; startClipDrag(ch, e); return; } } // grab a clip handle (plane dot / box face) → drag it
|
|
2587
2827
|
if (dimMode3d) { // 2-click dimension placement (not a drag): pick A, then B → place
|
|
2588
2828
|
e.stopPropagation(); controls.enabled = true;
|
|
@@ -2684,6 +2924,7 @@ function onMove(e) {
|
|
|
2684
2924
|
if (!renderer || !canvasEl || canvasEl.style.display === 'none') return; // 3D inactive — ignore window pointer events
|
|
2685
2925
|
if (boxSel) { onBoxMove(e); return; }
|
|
2686
2926
|
if (pending && pending.clipDrag) { onMoveClip(e); return; } // dragging a clip handle (plane offset / box face)
|
|
2927
|
+
if (pending && pending.frameDrag) { onMoveFrame(e); return; } // dragging the local-frame origin / rotation ring
|
|
2687
2928
|
if (!pending || pending.geo) return;
|
|
2688
2929
|
if (pending.epDrag) { onMoveEndpoint(e); return; }
|
|
2689
2930
|
if (!pending.grab || !pending.origMm) return;
|
|
@@ -2844,6 +3085,7 @@ function onUp(e) {
|
|
|
2844
3085
|
const moved = downXY ? Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) : Infinity; downXY = null;
|
|
2845
3086
|
if (!p) return;
|
|
2846
3087
|
if (p.clipDrag) return; // a clip handle drag is applied live during onMoveClip; nothing to commit on up (controls re-enabled above)
|
|
3088
|
+
if (p.frameDrag) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; return; } // local-frame origin/rotation is applied live during onMoveFrame; session-only, nothing to commit — clear the snap marker/readout on release
|
|
2847
3089
|
if (p.epDrag) { // end-node drag → write just that endpoint's wp; a click (no drag) just selects the member
|
|
2848
3090
|
if (wasDragging && p.newPt && api && api.onMoveEndpoint) { if (api.onSelect) api.onSelect(p.id, false); api.onMoveEndpoint(p.id, p.end, planPointToWp(p.newPt, p.ppf)); }
|
|
2849
3091
|
else if (api && api.onSelect) api.onSelect(p.id, false);
|
|
@@ -2894,6 +3136,30 @@ function closestOnSeg3(p, a, b) {
|
|
|
2894
3136
|
}
|
|
2895
3137
|
|
|
2896
3138
|
// ---- hover: cursor + readout chip (no drag in progress) ----
|
|
3139
|
+
// UCS Stage 2 — live local-coordinate readout. Show a resolved world point in the ACTIVE local frame
|
|
3140
|
+
// as X′/Y′/Z′ (measured from the local origin along its axes), or as plain global X/Y/Z at identity
|
|
3141
|
+
// (worldToLocal on identityFrame is a no-op), as a second row of the cursor readout chip. Fed once per
|
|
3142
|
+
// resolver step from the hover RAF (never double-subscribed); the row is cleared on pointerdown so a
|
|
3143
|
+
// drag never shows a lingering coordinate.
|
|
3144
|
+
const RO_IDENT = identityFrame(); // reused every global-mode hover so we don't alloc a frame per RAF
|
|
3145
|
+
const RO_AX = ['X', 'Y', 'Z'];
|
|
3146
|
+
function roFmt(mm) { if (Math.abs(mm) < 0.5) mm = 0; return api && api.fmtLen ? api.fmtLen(mm) : (mm / FT_MM).toFixed(2) + ' ft'; } // snap sub-1/16" float noise to 0 so a plane point never reads "-0""
|
|
3147
|
+
function roCoords(worldPt) {
|
|
3148
|
+
if (!readout || !readout._coord || !worldPt) return;
|
|
3149
|
+
const local = worldToLocal(worldPt, frame3d || RO_IDENT); // identity → the point's global coords
|
|
3150
|
+
const prime = frame3d ? '′' : ''; // U+2032 prime marks a local axis; plain X/Y/Z at global
|
|
3151
|
+
for (let i = 0; i < 3; i++) { readout._coordL[i].textContent = RO_AX[i] + prime + ' '; readout._coordV[i].textContent = roFmt(local[i]); }
|
|
3152
|
+
readout._coord.classList.toggle('ro-local', !!frame3d); // cyan the row only when a local frame is set (reuses #csStat.local's accent)
|
|
3153
|
+
readout._coord.style.display = '';
|
|
3154
|
+
}
|
|
3155
|
+
// A single-point pick with no length yet (base point, first Add/Move/Copy/Dim click, frame 3-click set):
|
|
3156
|
+
// show the chip with the coord row as its only content (clear the length line first).
|
|
3157
|
+
function roShowCoordOnly(worldPt, x, y) {
|
|
3158
|
+
if (!readout) return;
|
|
3159
|
+
readout._dist.textContent = ''; readout._type.textContent = '';
|
|
3160
|
+
roCoords(worldPt);
|
|
3161
|
+
readout.style.left = (x + 14) + 'px'; readout.style.top = (y + 14) + 'px'; readout.style.display = 'block';
|
|
3162
|
+
}
|
|
2897
3163
|
function onHoverMove(e) {
|
|
2898
3164
|
lastHoverXY = [e.clientX, e.clientY];
|
|
2899
3165
|
dimLastAlt = e.altKey; // remembered so the rAF body can rebuild a synthetic event
|
|
@@ -2910,6 +3176,7 @@ function onHoverMove(e) {
|
|
|
2910
3176
|
readout._dist.textContent = api.fmtLen ? api.fmtLen(p.z) : (p.z / 304.8).toFixed(2) + ' ft';
|
|
2911
3177
|
readout._type.textContent = p.snapped ? ' · ' + (p.label || 'level') : ' ↕';
|
|
2912
3178
|
readout.style.left = (lastHoverXY[0] + 14) + 'px'; readout.style.top = (lastHoverXY[1] + 14) + 'px'; readout.style.display = 'block';
|
|
3179
|
+
roCoords([p.x, p.y, p.z]);
|
|
2913
3180
|
} else { marker.visible = false; readout.style.display = 'none'; canvasEl.style.cursor = 'crosshair'; }
|
|
2914
3181
|
return;
|
|
2915
3182
|
}
|
|
@@ -2926,7 +3193,8 @@ function onHoverMove(e) {
|
|
|
2926
3193
|
canvasEl.style.cursor = 'crosshair';
|
|
2927
3194
|
if (tfDraft) tfPreview({ clientX: lastHoverXY[0], clientY: lastHoverXY[1], altKey: dimLastAlt, shiftKey: tfLastShift });
|
|
2928
3195
|
else { const r = wpPointAt({ clientX: lastHoverXY[0], clientY: lastHoverXY[1], altKey: dimLastAlt });
|
|
2929
|
-
if (r && r.snap) showMarker(r.p, r.type); else marker.visible = false;
|
|
3196
|
+
if (r && r.snap) showMarker(r.p, r.type); else marker.visible = false;
|
|
3197
|
+
if (r) roShowCoordOnly(r.p, lastHoverXY[0], lastHoverXY[1]); else if (readout) readout.style.display = 'none'; } // local coords of the base point before it's picked
|
|
2930
3198
|
updateStatusChip(); return; }
|
|
2931
3199
|
if (clipMode) { canvasEl.style.cursor = 'crosshair'; if (clipMode === 'box') clipBoxPreviewAt(lastHoverXY[0], lastHoverXY[1]); return; } // armed clip pick: crosshair (+ live box preview while drawing)
|
|
2932
3200
|
if (dimMode3d) { // dim tool: snap marker + live preview line + readout (no member hover)
|
|
@@ -2941,7 +3209,21 @@ function onHoverMove(e) {
|
|
|
2941
3209
|
readout._dist.textContent = api.fmtLen ? api.fmtLen(g.valueMm) : (g.valueMm / 304.8).toFixed(2) + ' ft';
|
|
2942
3210
|
readout._type.textContent = r.type ? ' · ' + r.type : (dimLastAlt ? ' ↕' : '');
|
|
2943
3211
|
readout.style.left = (lastHoverXY[0] + 14) + 'px'; readout.style.top = (lastHoverXY[1] + 14) + 'px'; readout.style.display = 'block';
|
|
2944
|
-
|
|
3212
|
+
roCoords(r.p); // local coords of the second dim point
|
|
3213
|
+
} else { dimPreviewLine.visible = false;
|
|
3214
|
+
if (r && !dimDraft3d) roShowCoordOnly(r.p, lastHoverXY[0], lastHoverXY[1]); // first dim point: coords-only chip
|
|
3215
|
+
else if (readout) readout.style.display = 'none'; } // no point (or a draft with the cursor off-plane) → clear the chip, don't freeze the last readout
|
|
3216
|
+
return;
|
|
3217
|
+
}
|
|
3218
|
+
if (framePicking()) { // 3-click UCS set in progress: live rubber-band X/Y + Z-flip arrow, snap marker at the cursor
|
|
3219
|
+
canvasEl.style.cursor = 'crosshair';
|
|
3220
|
+
renderFramePickPreview({ clientX: lastHoverXY[0], clientY: lastHoverXY[1], altKey: dimLastAlt });
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
if (frameMode) { // armed local-frame: over the origin/ring → grab cursor + brighten the ring; else crosshair (no member hover while armed)
|
|
3224
|
+
let fh = null; try { fh = pickFrameHandle(lastHoverXY[0], lastHoverXY[1]); } catch { fh = null; }
|
|
3225
|
+
if (frameGizmo) for (const h of frameGizmo.children) if (h.userData && h.userData.frameHandle === 'ring' && h.material) h.material.opacity = (fh === 'ring') ? 1 : 0.85; // stateless: set both ways every hover, no restore needed
|
|
3226
|
+
canvasEl.style.cursor = fh ? 'grab' : 'crosshair';
|
|
2945
3227
|
return;
|
|
2946
3228
|
}
|
|
2947
3229
|
if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(lastHoverXY[0], lastHoverXY[1]); } catch { ch = null; } if (ch) { canvasEl.style.cursor = 'move'; return; } } // over a clip handle → move cursor
|
|
@@ -2987,12 +3269,13 @@ function updateStatusChip() {
|
|
|
2987
3269
|
hoverChip.style.display = canvasEl.style.display === 'none' ? 'none' : 'block';
|
|
2988
3270
|
}
|
|
2989
3271
|
|
|
2990
|
-
function show() { if (controls) controls.enabled = true; if (canvasEl) { canvasEl.style.display = 'block'; resize(); } if (!rafId) loop(); updateStatusChip(); refreshDims(); refreshOverlayDims(); } // resume the render loop (reset orbit in case a gesture was stranded by a mid-drag hide)
|
|
3272
|
+
function show() { if (controls) controls.enabled = true; if (canvasEl) { canvasEl.style.display = 'block'; resize(); } if (!rafId) loop(); updateStatusChip(); refreshDims(); refreshOverlayDims(); renderFrameGizmo(); } // resume the render loop (reset orbit in case a gesture was stranded by a mid-drag hide)
|
|
2991
3273
|
function hide() {
|
|
2992
3274
|
if (dimMode3d) toggleDimTool(); // disarm the dim tool + sync its toolbar (no stale draft/armed state on return)
|
|
2993
3275
|
if (clipMode) setClipMode(null); // disarm the clip-plane pick too (no stale armed state on return)
|
|
2994
3276
|
if (insertMode) setInsertMode(false); // disarm a pending detail placement — else the first click on return would place it
|
|
2995
3277
|
if (wpMode) { wpMode = null; wpDraft = null; if (marker) marker.visible = false; reflectWpBar(); } // drop an in-progress set-plane pick — else a stale face/3pt pick steals the first click on return
|
|
3278
|
+
if (frameMode || (pending && pending.frameDrag) || framePicking()) { if (pending && pending.frameDrag && frame3d && pending.preFrame) frame3d = cloneFrame(pending.preFrame); cancelFramePick(); frameMode = false; if (pending && pending.frameDrag) pending = dragging = null; if (readout) readout.style.display = 'none'; fireFrameChange(); } // leaving 3D disarms the local-frame manipulator + cancels an in-progress pick/drag
|
|
2996
3279
|
cmClear3d(); drClear3d(); // and any 3D Move/Copy or draw draft/ghosts
|
|
2997
3280
|
if (dimLabelHost) dimLabelHost.style.display = 'none'; // the loop that hides labels is about to stop — hide synchronously so none are stranded
|
|
2998
3281
|
if (memberLabelHost) memberLabelHost.style.display = 'none'; // member labels ride the same about-to-stop loop — hide them too, or they strand over the 2D UI
|
|
@@ -3039,7 +3322,7 @@ function dispose() {
|
|
|
3039
3322
|
gridTexCache.clear();
|
|
3040
3323
|
clearRoot();
|
|
3041
3324
|
if (workAreaHelper) { if (overlayScene) overlayScene.remove(workAreaHelper); workAreaHelper.geometry.dispose(); workAreaHelper.material.dispose(); workAreaHelper = null; }
|
|
3042
|
-
clearConnEnvelope(); clearClipGizmo(); setClipPreview(null); overlayScene = null;
|
|
3325
|
+
clearConnEnvelope(); clearClipGizmo(); setClipPreview(null); disposeFramePreview(); disposeFrameGizmo(); overlayScene = null; // dispose the frame gizmo/preview THREE resources before dropping the scene (Codex)
|
|
3043
3326
|
clips = []; workArea = null; clipMode = null; selectedClipIds.clear(); clipBoxDraft = null; // clips live on the renderer; drop them with the renderer
|
|
3044
3327
|
if (renderer) renderer.dispose();
|
|
3045
3328
|
renderer = scene = camera = perspCam = orthoCam = controls = root = api = canvasEl = ro = null; built = false;
|
|
@@ -3118,6 +3401,8 @@ window.Steel3DView = {
|
|
|
3118
3401
|
cameraState, setCameraState, objectsPaneState, applyObjectsPaneState, // saved-view snapshot surface (Views Organizer)
|
|
3119
3402
|
workAreaSetAll, workAreaFromSelection, workAreaToggle, workAreaSetWhole, clearWorkArea, workAreaState,
|
|
3120
3403
|
armWorkPlanePick, setWorkPlanePrincipal, clearWorkPlane, toggleWorkPlaneVisible, workPlaneInfo,
|
|
3404
|
+
armFrame3d, disarmFrame3d, repickFrame3d, setFrame3d, setFrameBasis, setFrameAngle, setFrameOrigin, clearFrame3d, frameInfo, frameArmed: () => frameMode, framePicking, framePickStep, frameHandlesScreen, // 3D local drawing frame (UCS stage 1)
|
|
3405
|
+
coordReadout: () => { if (!readout || !readout._coord || readout.style.display === 'none' || readout._coord.style.display === 'none') return null; return { local: readout._coord.classList.contains('ro-local'), values: readout._coordV.map((v) => v.textContent), labels: readout._coordL.map((l) => l.textContent.trim()), text: readout._coord.textContent }; }, // UCS stage 2 test probe: the live local-coordinate row (null when hidden)
|
|
3121
3406
|
cmEscape, cmHasBase, cmClear3d, setCmAxis, cmLastClient, cmHudApply,
|
|
3122
3407
|
drClear3d, drEscape: () => { if (drDraft) { drDraft = null; drClear3d(); return true; } return false; },
|
|
3123
3408
|
toggleDimTool, setDimAxis, dimAxis, setDims3dVisible, dims3dVisible, refreshDims,
|
|
@@ -145,9 +145,14 @@
|
|
|
145
145
|
.aithumb{position:relative;display:inline-flex} .aithumb img{height:60px;border-radius:4px;border:1px solid var(--line);background:#fff;display:block}
|
|
146
146
|
.aithumb button{position:absolute;top:-5px;right:-5px;width:16px;height:16px;padding:0;border-radius:8px;font-size:10px;line-height:16px;text-align:center;background:#7f1d1d;border-color:#991b1b;color:#fecaca}
|
|
147
147
|
#saveStat.dirty{color:#fbbf24} #saveStat.ok{color:#86efac} #saveStat.err{color:#fca5a5}
|
|
148
|
-
#csStat.local{border:1px solid #22d3ee;background:rgba(34,211,238,.10);border-radius:4px;padding:1px 6px} /* lift the chip out of the muted row when a local frame is active (reuses the dim/accent cyan — no new colour) */
|
|
148
|
+
#csStat.local{border:1px solid #22d3ee;background:rgba(34,211,238,.10);border-radius:4px;padding:1px 6px;cursor:pointer} /* lift the chip out of the muted row when a local frame/plane is active (reuses the dim/accent cyan — no new colour); clickable → reset to global */
|
|
149
149
|
#snapStat{cursor:pointer;border:1px solid #22d3ee;background:rgba(34,211,238,.10);border-radius:4px;padding:1px 6px} /* snap-override chip — same cyan treatment as #csStat.local; the cyan IS the snap-marker colour it restricts */
|
|
150
150
|
#snapStat:hover b{color:#fff}
|
|
151
|
+
/* UCS stage 2 — live local-coordinate row inside the 3D cursor readout chip (steel-3d-view.js builds the element). */
|
|
152
|
+
.ro-coord{font-variant-numeric:tabular-nums;color:var(--mut,#94a3b8);white-space:nowrap;font-size:12px}
|
|
153
|
+
.ro-coord .ro-lbl{margin-left:9px} .ro-coord .ro-lbl:first-child{margin-left:0}
|
|
154
|
+
.ro-coord b{color:var(--text,#f8fafc);font-weight:400}
|
|
155
|
+
.ro-coord.ro-local,.ro-coord.ro-local b{color:#22d3ee} /* whole row goes cyan when a local frame is set — reuses #csStat.local's accent, no new colour */
|
|
151
156
|
#snapMenu{position:fixed;left:0;top:0;z-index:45;min-width:186px} /* right-click snap menu — reuses the .m3dmenu skin, opened at the cursor */
|
|
152
157
|
#snapMenu .sg{display:inline-block;width:17px;color:#22d3ee} /* leading glyph = the marker the cursor will show */
|
|
153
158
|
#snapMenu button.dim{opacity:.55} /* a running-snap turned off in the ⋯ menu — still forceable here (AutoCAD-style) */
|
|
@@ -172,6 +177,15 @@
|
|
|
172
177
|
#moreMenu #m3dInsertMenu{left:auto;right:calc(100% + 4px);top:0}
|
|
173
178
|
body:not(.v3d) #moreMenu #insWrap{display:none} /* Insert detail places into the 3D scene — hide it in 2D (needs 2 ids to beat the .m3dwrap.ins-in-menu display:block) */
|
|
174
179
|
body.v3d #moreMenu #dimStyleB{display:none} /* …and the mirror: Dimension style edits the 2D dim overlay, so it has nothing to show in 3D (Grid lines… stays — a grid IS drawn in 3D) */
|
|
180
|
+
body.v3d #moreMenu #csSetB{display:none} /* the 2D set-local-axes (P.frame) is 2D-only… */
|
|
181
|
+
body:not(.v3d) #moreMenu #csArm3dB,body:not(.v3d) #moreMenu #csF3dFields{display:none} /* …and the 3D local frame is 3D-only */
|
|
182
|
+
#moreMenu #csArm3dB.on{border-color:var(--brand);color:var(--brand)}
|
|
183
|
+
#csF3dFields{display:none;grid-template-columns:auto 1fr;gap:4px 7px;align-items:center;margin:6px 2px 2px} /* base hide as a RULE (not inline) so #csF3dFields.on can override it — an inline display:none can't be beaten by a class (Codex) */
|
|
184
|
+
#csF3dFields.on{display:grid}
|
|
185
|
+
#csF3dFields .csf3lab{font:12px system-ui;color:var(--mut)}
|
|
186
|
+
#csF3dFields .csf3val{font:12px system-ui;color:var(--text);padding:0 2px;min-height:26px;display:flex;align-items:center} /* read-only orientation readout — a label/value row, never a disabled input (orientation is set by the pick + ring, not typed) */
|
|
187
|
+
#csF3dFields input{width:100%;height:26px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:5px;padding:0 7px;font:12px system-ui}
|
|
188
|
+
#csF3dFields input:focus{outline:none;border-color:var(--brand)}
|
|
175
189
|
#moreMenu button.msnap,#moreMenu button.dtog{display:flex;align-items:center;gap:0} /* .dtog = the Display show/hide toggles, same slider switch as Snapping (.msnap) */
|
|
176
190
|
#moreMenu button.msnap.on,#moreMenu button.dtog.on{color:var(--text)} /* the switch carries the state — don't also brand the text (reads as an armed tool elsewhere in this menu) */
|
|
177
191
|
#moreMenu .mck,.cmmenu .mck,.m3dmenu .mck{position:relative;width:26px;height:14px;margin-right:9px;border-radius:7px;border:1px solid var(--line);background:#0b1220;flex:none;transition:background-color .15s,border-color .15s} /* delicate CSS-only slider switch — shared by the ⋯ Snapping rows, the Move/Copy → Drag-to-move/copy toggle, and the Work-area toggles */
|
|
@@ -761,6 +775,13 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
761
775
|
<button class=msec-hdr data-sec=coords aria-expanded=false data-tip="Local vs global drawing axes (for skewed framing)">Coordinate system<span class=chev aria-hidden=true>▸</span></button>
|
|
762
776
|
<div class=msec-body>
|
|
763
777
|
<button id=csSetB data-tip="Define a local X axis by clicking two points (origin, then X-direction). Y follows at 90°. Orthogonal drawing and X/Y dimensions then snap to this frame — for skewed framing.">↺ Set local axes…</button>
|
|
778
|
+
<button id=csArm3dB data-tip="Set the local drawing frame (3D): click 3 points — origin, X-direction, then a point on the Y side (which also sets which way Z points). Then drag the amber origin or the cyan ring to refine.">↺ Set local axes (3D)…</button>
|
|
779
|
+
<div id=csF3dFields>
|
|
780
|
+
<label class=csf3lab>Orientation</label><span id=csF3dOri class=csf3val data-tip="Set by the 3-click pick; spin it with the cyan ring. Re-pick to change the tilt.">—</span>
|
|
781
|
+
<label class=csf3lab>Origin X (ft)</label><input id=csF3dX type=number step=0.1 inputmode=decimal autocomplete=off>
|
|
782
|
+
<label class=csf3lab>Origin Y (ft)</label><input id=csF3dY type=number step=0.1 inputmode=decimal autocomplete=off>
|
|
783
|
+
<label class=csf3lab>Origin Z (ft)</label><input id=csF3dZ type=number step=0.1 inputmode=decimal autocomplete=off>
|
|
784
|
+
</div>
|
|
764
785
|
<button id=csResetB data-tip="Return to the global X/Y axes (default)" disabled>Reset to global axes</button>
|
|
765
786
|
</div>
|
|
766
787
|
<button class=msec-hdr data-sec=session aria-expanded=false data-tip="Reload from the server, or export the data">Session<span class=chev aria-hidden=true>▸</span></button>
|
|
@@ -2314,6 +2335,22 @@ function panel(){
|
|
|
2314
2335
|
if(gridMode){renderGridPanel(p);return;}
|
|
2315
2336
|
if(dimStyleMode&&(selIds.size||selDimIds.size))dimStyleMode=false; // anything that selects (Ctrl+A, Duplicates, Reversed beams, a legend/RFI locate…) takes the panel back from the style pane — one guard instead of a disarm call at every such command
|
|
2316
2337
|
if(dimStyleMode){renderDimStylePanel(p);return;}
|
|
2338
|
+
if(view3d&&window.Steel3DView&&window.Steel3DView.frameArmed&&window.Steel3DView.frameArmed()){ // 3D local-frame armed → the panel-takeover idiom (badge + hint), like the 2D Set-local-axes / Dimension tools
|
|
2339
|
+
const _d3=window.Steel3DView,_step=(_d3.framePicking&&_d3.framePicking())?(_d3.framePickStep?_d3.framePickStep():0):null;
|
|
2340
|
+
if(_step!==null){ // collecting the 3-click set → step prompt
|
|
2341
|
+
const _pr=['Click the <b>origin</b> — snaps freely to member ends, grid points, or any geometry. <b>Esc</b> cancels.',
|
|
2342
|
+
'Click a second point to set local <b>X</b> — the axis runs from the origin toward it. <b>Esc</b> cancels.',
|
|
2343
|
+
'Click a third point on the <b>Y side</b>. This also sets which way <b>Z</b> points — click the other side of X to flip it. <b>Esc</b> cancels.'];
|
|
2344
|
+
p.innerHTML=`<span class=badge>Set local axes (3D)</span>
|
|
2345
|
+
<div class=hint style="margin-top:8px">${_pr[_step]||_pr[0]}</div>
|
|
2346
|
+
<div class=hint style="margin-top:8px">Three points define a full 3D frame — it re-aims the drawing tools; nothing in the model moves.</div>`;
|
|
2347
|
+
return;}
|
|
2348
|
+
p.innerHTML=`<span class=badge>Local axes (3D)</span>
|
|
2349
|
+
<div class=hint style="margin-top:8px">Local axes set. Drag the <b>amber origin</b> to move it, or the <b>cyan ring</b> to spin it. <b>Esc</b> exits.</div>
|
|
2350
|
+
<div class=hint style="margin-top:8px">Only re-aims the drawing tools (ortho, Move/Copy, Add) — nothing in the model moves.</div>
|
|
2351
|
+
<button id=csRepickB class=ghostw style="margin-top:10px" data-tip="Re-run the 3-click pick to change the origin, axes or tilt">↺ Re-pick…</button>`;
|
|
2352
|
+
const _rb=document.getElementById('csRepickB');if(_rb)_rb.onclick=()=>{if(_d3.repickFrame3d)_d3.repickFrame3d();};
|
|
2353
|
+
return;}
|
|
2317
2354
|
if(csaxisMode){p.innerHTML=`<span class=badge>Set local axes</span>
|
|
2318
2355
|
<div class=hint id=csHint style="margin-top:8px">${csDraft?'Click the <b>second</b> point — the local-X direction. Y follows at 90°.':'Click the <b>origin</b> point to start.'}</div>
|
|
2319
2356
|
<div class=hint style="margin-top:8px">Two clicks define the frame; snaps to member ends & grid (<b>Alt</b> off). <b>Esc</b> cancels.</div>`;return;}
|
|
@@ -3430,7 +3467,7 @@ function disarmCm(){cmTool=null;cmArrayMode=false;cmDraft=null;cmHudClose();cmPr
|
|
|
3430
3467
|
if(window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d();} // drop the 3D-side pick/preview too
|
|
3431
3468
|
function armCm(tool,array){ // re-arming the same config toggles the tool off — works in 2D and (on the working plane) in 3D
|
|
3432
3469
|
if(cmTool===tool&&cmArrayMode===!!array){disarmCm();render();return;}
|
|
3433
|
-
if(view3d&&window.Steel3DView){const dm=document.getElementById('m3dDim');if(dm&&dm.classList.contains('on'))window.Steel3DView.toggleDimTool();} // the 3D dim tool
|
|
3470
|
+
if(view3d&&window.Steel3DView){const dm=document.getElementById('m3dDim');if(dm&&dm.classList.contains('on'))window.Steel3DView.toggleDimTool();if(window.Steel3DView.disarmFrame3d)window.Steel3DView.disarmFrame3d();} // the 3D dim tool + the local frame share the left-click — disarm both
|
|
3434
3471
|
if(!selIds.size){toast('Select members first, then '+(tool==='move'?'Move':'Copy'));return;}
|
|
3435
3472
|
if(mode==='add'){mode='sel';setMode();if(window.Steel3DView&&window.Steel3DView.drClear3d)window.Steel3DView.drClear3d();}
|
|
3436
3473
|
if(dimMode){dimMode=false;setDimMode();}
|
|
@@ -3658,9 +3695,17 @@ function axisGlyphSvg(o,dir,preview){
|
|
|
3658
3695
|
+`<circle cx="${ox}" cy="${oy}" r="${4/zoom}" fill="#3b82f6" stroke="#e2e8f0" stroke-width="${1.5/zoom}"/>`
|
|
3659
3696
|
+tag(lx,'#ef4444','X')+tag(ly,'#22c55e','Y')+`</g>`;}
|
|
3660
3697
|
// header chip + the More-menu "Reset to global" enabled state — reflect the current frame.
|
|
3661
|
-
function updCS(){const s=document.getElementById('csStat');
|
|
3662
|
-
if(
|
|
3663
|
-
|
|
3698
|
+
function updCS(){const s=document.getElementById('csStat');const r=document.getElementById('csResetB');
|
|
3699
|
+
if(view3d&&window.Steel3DView&&window.Steel3DView.frameInfo){ // 3D → the local drawing frame (◇ Plane shadows it)
|
|
3700
|
+
const fi=window.Steel3DView.frameInfo(),local=fi.mode==='local',plane=fi.mode==='plane';
|
|
3701
|
+
const desc=plane?'Plane':(local?((fi.horizontal?Math.round(fi.angleDeg)+'°':'tilted')+' local (3D)'):'Global'); // a tilt can't be one number → the word "tilted" (numeric tilt lives in the panel/tooltip)
|
|
3702
|
+
if(s){s.innerHTML='Axes <b>'+desc+'</b>';s.classList.toggle('local',local||plane);
|
|
3703
|
+
s.dataset.tip=local?(fi.horizontal?'Local axes active (3D) — drag the amber origin / cyan ring, or re-pick from the ⋯ menu to change them. Click to reset to global.':'Local axes active (3D), tilted out of horizontal — drag the amber origin / cyan ring to spin them in place, or re-pick from the ⋯ menu to change the tilt. Click to reset to global.'):(plane?'A working plane (◇ Plane) is set — it drives the axes. Click to clear it.':'Global axes (default). Set local axes (3D) from the ⋯ menu for skewed framing.');}
|
|
3704
|
+
if(r)r.disabled=!local;return;
|
|
3705
|
+
}
|
|
3706
|
+
const f=P&&P.frame;
|
|
3707
|
+
if(s){s.innerHTML='Axes <b>'+(f?(Math.round(Math.atan2(f.u[1],f.u[0])*180/Math.PI)+'° local'):'Global')+'</b>';s.classList.toggle('local',!!f);s.dataset.tip=f?'Local axes active — ortho draw & X/Y dimensions follow them. Click to reset to global.':'Global axes (default). Set local axes from the ⋯ menu for skewed framing.';}
|
|
3708
|
+
if(r)r.disabled=!(P&&P.frame);}
|
|
3664
3709
|
// themed transient toast (baseline tokens — never a native alert)
|
|
3665
3710
|
function toast(msg){let t=document.getElementById('toast');
|
|
3666
3711
|
if(!t){t=document.createElement('div');t.id='toast';t.style.cssText='position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:8px 14px;box-shadow:0 6px 20px rgba(0,0,0,.5);z-index:60;font:13px system-ui;opacity:0;transition:opacity .2s;pointer-events:none';document.body.appendChild(t);}
|
|
@@ -3894,11 +3939,38 @@ function setMode(){document.body.classList.toggle('add',mode==='add');document.g
|
|
|
3894
3939
|
picking=false;pickKind='profile';pickEnd=null; // a pick armed in one mode must never bleed into the other (an inspector ⌖ pick would otherwise show the Add panel's button pre-armed)
|
|
3895
3940
|
if(mode!=='add'){drawDraft=null;drawPrevClear();}} // leaving Add-member drops any in-progress start point + its preview
|
|
3896
3941
|
document.getElementById('mAdd').onclick=()=>{if(dimMode){dimMode=false;setDimMode();}if(csaxisMode){csaxisMode=false;setCsMode();}if(cmTool)disarmCm();
|
|
3897
|
-
if(view3d&&window.Steel3DView){const dm=document.getElementById('m3dDim');if(dm&&dm.classList.contains('on'))window.Steel3DView.toggleDimTool();} // the 3D dim tool
|
|
3942
|
+
if(view3d&&window.Steel3DView){const dm=document.getElementById('m3dDim');if(dm&&dm.classList.contains('on'))window.Steel3DView.toggleDimTool();if(window.Steel3DView.disarmFrame3d)window.Steel3DView.disarmFrame3d();} // the 3D dim tool + the local frame share the left-click — disarm both when entering add mode
|
|
3898
3943
|
selDimIds.clear();dimStyleMode=false;mode=(mode==='add'?'sel':'add');if(mode==='add')selIds.clear();else if(window.Steel3DView&&window.Steel3DView.drClear3d)window.Steel3DView.drClear3d();snapOnlyClear2d();setMode();render();setLastCmd('Add member',()=>{if(mode!=='add'){if(dimMode){dimMode=false;setDimMode();}mode='add';selIds.clear();setMode();render();}});}; // entering add/sel disarms the Dimension + set-axes tools + the Dimension style pane + drops any dim selection + reverts a snap override; leaving add clears the 3D draw draft
|
|
3899
3944
|
document.getElementById('dimB').onclick=()=>{if(csaxisMode){csaxisMode=false;setCsMode();}dimMode=!dimMode;setDimMode();render();setLastCmd('Dimension',()=>{if(!dimMode){dimMode=true;setDimMode();render();}});};
|
|
3900
3945
|
document.getElementById('csSetB').onclick=()=>{csaxisMode=!csaxisMode;setCsMode();render();};
|
|
3901
|
-
document.getElementById('csResetB').onclick=()=>{resetFrame();render();};
|
|
3946
|
+
document.getElementById('csResetB').onclick=()=>{ if(view3d&&window.Steel3DView&&window.Steel3DView.clearFrame3d){window.Steel3DView.clearFrame3d();csSyncF3d();updCS();} else {resetFrame();render();} };
|
|
3947
|
+
document.getElementById('csStat').onclick=()=>{ // click the Axes chip → reset to global (easy exit; mirrors ⋯ "Reset to global axes", and clears a set ◇ Plane)
|
|
3948
|
+
if(view3d&&window.Steel3DView){const d3=window.Steel3DView,fi=d3.frameInfo&&d3.frameInfo();
|
|
3949
|
+
if(fi&&fi.mode==='plane'){if(d3.clearWorkPlane)d3.clearWorkPlane();}
|
|
3950
|
+
else if(fi&&fi.mode==='local'){if(d3.clearFrame3d)d3.clearFrame3d();}
|
|
3951
|
+
else return; // already global → nothing to reset
|
|
3952
|
+
if(typeof csSyncF3d==='function')csSyncF3d();updCS();}
|
|
3953
|
+
else if(P&&P.frame){resetFrame();render();}};
|
|
3954
|
+
// 3D local drawing frame (UCS): arm the 3-click pick / drag-refine + read-only orientation + editable origin
|
|
3955
|
+
let csPrevPick=null; // prior pick step (0/1/2|null) — so #panel re-renders on each pick step + on commit, but NOT on every drag tick
|
|
3956
|
+
function csSyncF3d(){const d3=window.Steel3DView;if(!d3||!d3.frameInfo)return;
|
|
3957
|
+
const fi=d3.frameInfo(),armed=!!(d3.frameArmed&&d3.frameArmed()),armB=document.getElementById('csArm3dB'),fields=document.getElementById('csF3dFields');
|
|
3958
|
+
const pick=(d3.framePicking&&d3.framePicking())?(d3.framePickStep?d3.framePickStep():0):null, pickChanged=pick!==csPrevPick; csPrevPick=pick;
|
|
3959
|
+
const wasArmed=armB?armB.classList.contains('on'):false; // arm/disarm edge — take over / release #panel only on the transition (+ pick-step changes), not on every drag tick
|
|
3960
|
+
if(armB)armB.classList.toggle('on',armed);if(fields)fields.classList.toggle('on',armed);
|
|
3961
|
+
if(armed){const FT=304.8,set=(id,v)=>{const el=document.getElementById(id);if(el&&document.activeElement!==el)el.value=v;};
|
|
3962
|
+
const ori=document.getElementById('csF3dOri');
|
|
3963
|
+
if(fi.mode==='local'){
|
|
3964
|
+
if(ori)ori.textContent=fi.horizontal?(Math.round(fi.angleDeg)+'°'+(fi.zUp?'':' · Z down')):('Tilted '+Math.round(fi.tiltDeg)+'° · Z '+(fi.zUp?'up':'down')); // read-only: set by the pick, spun by the ring; note a flipped-Z horizontal frame (Codex)
|
|
3965
|
+
set('csF3dX',(fi.origin[0]/FT).toFixed(2));set('csF3dY',(fi.origin[1]/FT).toFixed(2));set('csF3dZ',(fi.origin[2]/FT).toFixed(2));}
|
|
3966
|
+
else if(ori)ori.textContent='—';}
|
|
3967
|
+
if((wasArmed!==armed||pickChanged)&&typeof panel==='function')panel();} // arm/disarm edge OR a pick-step change → repaint #panel (drag ticks don't, so no per-move rebuild)
|
|
3968
|
+
document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(!d3||!d3.armFrame3d)return;const armed=!!(d3.frameArmed&&d3.frameArmed());d3.armFrame3d(!armed);csSyncF3d();updCS();};
|
|
3969
|
+
['csF3dX','csF3dY','csF3dZ'].forEach(id=>{const el=document.getElementById(id);if(!el)return; // Origin X/Y/Z stay editable (translate-only); orientation is read-only (pick + ring)
|
|
3970
|
+
el.addEventListener('input',()=>{const d3=window.Steel3DView;if(!d3)return;const FT=304.8;
|
|
3971
|
+
const fi=d3.frameInfo(),o=fi.origin?[...fi.origin]:[0,0,0],x=parseFloat(document.getElementById('csF3dX').value)*FT,y=parseFloat(document.getElementById('csF3dY').value)*FT,z=parseFloat(document.getElementById('csF3dZ').value)*FT;
|
|
3972
|
+
d3.setFrameOrigin([isNaN(x)?o[0]:x,isNaN(y)?o[1]:y,isNaN(z)?o[2]:z]);
|
|
3973
|
+
updCS();});});
|
|
3902
3974
|
function updDimToggle(){const b=document.getElementById('dimToggleB');if(b){b.classList.toggle('on',dimsVisible);b.setAttribute('aria-checked',String(dimsVisible));}}
|
|
3903
3975
|
document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();dimsVisible=!dimsVisible;updDimToggle();render();};
|
|
3904
3976
|
function updLenToggle(){const b=document.getElementById('lenToggleB');if(b){b.classList.toggle('on',showSelLen);b.setAttribute('aria-checked',String(showSelLen));}}
|
|
@@ -4102,6 +4174,7 @@ document.getElementById('cpLevelB').onclick=()=>openLevelModal('copy');
|
|
|
4102
4174
|
// member Inspector can show a read-only "Cope (auto)" note (a coped beam otherwise looks like an error).
|
|
4103
4175
|
let copesByMember={}, partsById={};
|
|
4104
4176
|
const view3dApi={
|
|
4177
|
+
onFrame3dChange:()=>{updCS();if(typeof csSyncF3d==='function')csSyncF3d();}, // the 3D local frame moved/armed/reset → resync the Axes chip + the numeric fields
|
|
4105
4178
|
// POST the in-progress contract so the model reflects unsaved edits; throws on a bad contract.
|
|
4106
4179
|
fetchScene:async()=>{const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract:C})});const j=await r.json();if(!j.ok)throw new Error(j.error||'scene render failed');
|
|
4107
4180
|
// The bake reports everything it could NOT emit in `skipped[]`, and we used to discard it entirely — so a
|
|
@@ -5457,6 +5530,7 @@ async function setView(on){
|
|
|
5457
5530
|
if(!view3dReady){window.Steel3DView.init(document.getElementById('stage3d'),view3dApi);view3dReady=true;}
|
|
5458
5531
|
applyViewState(true);
|
|
5459
5532
|
window.Steel3DView.show();
|
|
5533
|
+
updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // reflect the (persisted) 3D local frame in the Axes chip IMMEDIATELY — before the awaited rebuild, else the chip shows a stale "Global" for the rebuild's duration (QA F14)
|
|
5460
5534
|
await window.Steel3DView.rebuild(true); // fit the camera on entering 3D
|
|
5461
5535
|
window.Steel3DView.setSelection(selIds);
|
|
5462
5536
|
wire3DBar();wireLegendTabs();loadSteelFavourites();build3DLegend();showLegendPanel(); // build the Objects body + load the (global) favourites library, then open the panel on the last-used tab
|
|
@@ -5471,6 +5545,7 @@ async function setView(on){
|
|
|
5471
5545
|
if(propPopOpen()){if(propPopPinned){dockPropPop();renderPropPop();}else closePropPop(true);} // the popup is anchored to one canvas — re-dock if pinned (renderPropPop re-syncs its "Show in this view" checkbox to the now-live view), else dismiss on the view switch
|
|
5472
5546
|
panel(); // repaint the inspector for the NOW-current view (view3d is final here): a cross-view tool stays armed but its in-progress draft was dropped above — Add-member's drawHint (:2288) and Move/Copy's cmHint are view-specific, so without this the panel keeps the stale 2D "Click 2: end" (drawDraft already null) instead of the 3D working-plane hint (and vice-versa on return)
|
|
5473
5547
|
refreshPropLabels3d();updatePropHint(); // push the label set to whichever view is now live (3D shows them; 2D hides the 3D host) + refresh the corner note
|
|
5548
|
+
updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // the Axes chip is view-scoped (2D=P.frame, 3D=frame3d) — resync it + the 3D-frame fields on every switch (applyViewState alone doesn't; Codex MAJOR 6)
|
|
5474
5549
|
}
|
|
5475
5550
|
document.getElementById('vt2d').onclick=()=>{if(view3d)setView(false);};
|
|
5476
5551
|
document.getElementById('vt3d').onclick=()=>{if(!view3d)setView(true);};
|