@floless/app 0.127.4 → 0.127.6
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 +498 -80
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +9 -1
- package/dist/web/grid-core.js +47 -0
- package/dist/web/steel-3d-view.js +98 -35
- package/dist/web/steel-editor.html +130 -59
- package/dist/web/steel-model-v2-commands.js +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-steel-takeoff
|
|
3
3
|
description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.18.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
|
|
@@ -275,6 +275,14 @@ sheets (Foundation, each Floor, Roof). **Show the user the list and get an expli
|
|
|
275
275
|
"I found these framing plans: Foundation, 2nd Floor, Roof — filter all of these?" — before the pass. (The full
|
|
276
276
|
elevation/detail classification is the broader workflow; here we only need the plan set.)
|
|
277
277
|
|
|
278
|
+
**Narrow headless revision exception.** When floless.app's server-owned headless preamble explicitly
|
|
279
|
+
says this is a phase-one-only `revision-read`, exposes only the immutable leased PDF sources plus the
|
|
280
|
+
request-scoped contract/prepass calls, and requires the exact Steel Filter Save question, do not
|
|
281
|
+
create an earlier plan-confirmation checkpoint. Match framing pages only to the plan sheet names
|
|
282
|
+
already present in that project's current contract; if the match is absent or ambiguous, stop with
|
|
283
|
+
`needs-you` instead of inventing a plan name. This exception never applies to an initial read, an
|
|
284
|
+
interactive session, or phase two, and it is not permission to read members before the Filter Save.
|
|
285
|
+
|
|
278
286
|
⚠️ **This ONE plan-scope confirm covers both the filter pass AND the member read — they run on the
|
|
279
287
|
same sheet set. Getting the OK does NOT mean "go read members"; the very next thing you do is the
|
|
280
288
|
filter pass below, then hand off the Filter node. Do not let the confirm gate double as permission to
|
package/dist/web/grid-core.js
CHANGED
|
@@ -200,6 +200,53 @@ export function visibleGridLevels(levels = [], hiddenZ = []) {
|
|
|
200
200
|
return (Array.isArray(levels) ? levels : []).filter((level) => !hidden.has(gridLevelKey(level && level.mm)));
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Identity of the authored grid currently rendered in 3D. Regular grid ids (`gv:i` / `gh:i`) are
|
|
205
|
+
* positional, so transient selection/visibility state may only survive while this signature is exact.
|
|
206
|
+
*/
|
|
207
|
+
export function gridTransientScopeSignature(scopeKey, draw) {
|
|
208
|
+
return JSON.stringify([
|
|
209
|
+
String(scopeKey == null ? '' : scopeKey),
|
|
210
|
+
draw && draw.g ? draw.g : null,
|
|
211
|
+
draw && Number.isFinite(draw.k) ? draw.k : null,
|
|
212
|
+
!!(draw && draw.flipY),
|
|
213
|
+
]);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Reconcile session-only 3D grid state against one completed structural-grid rebuild.
|
|
218
|
+
* A changed authored scope clears positional ids instead of silently applying them to another line.
|
|
219
|
+
*/
|
|
220
|
+
export function reconcileGridTransientState(state = {}, validIds = [], scopeChanged = false) {
|
|
221
|
+
const valid = new Set(Array.isArray(validIds) ? validIds : []);
|
|
222
|
+
const priorSelected = Array.isArray(state.selected) ? state.selected : [];
|
|
223
|
+
const priorHidden = Array.isArray(state.hidden) ? state.hidden : [];
|
|
224
|
+
const priorIsolated = Array.isArray(state.isolated) ? state.isolated : null;
|
|
225
|
+
const meshIsolationCount = Number.isFinite(state.meshIsolationCount) ? Math.max(0, state.meshIsolationCount) : 0;
|
|
226
|
+
const keep = (ids) => ids.filter((id) => valid.has(id));
|
|
227
|
+
const selected = scopeChanged ? [] : keep(priorSelected);
|
|
228
|
+
const hidden = scopeChanged ? [] : keep(priorHidden);
|
|
229
|
+
let isolated = priorIsolated === null ? null : (scopeChanged ? [] : keep(priorIsolated));
|
|
230
|
+
const clearMeshIsolation = isolated !== null && isolated.length === 0 && meshIsolationCount === 0;
|
|
231
|
+
if (clearMeshIsolation) isolated = null;
|
|
232
|
+
const same = (a, b) => a === b || (Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => v === b[i]));
|
|
233
|
+
return {
|
|
234
|
+
selected, hidden, isolated, clearMeshIsolation,
|
|
235
|
+
selectionChanged: !same(priorSelected, selected),
|
|
236
|
+
changed: !same(priorSelected, selected) || !same(priorHidden, hidden) || !same(priorIsolated, isolated) || clearMeshIsolation,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Class-neutral status copy for selections that include logical grid lines. */
|
|
241
|
+
export function objectSelectionStatus(meshCount = 0, gridCount = 0) {
|
|
242
|
+
const meshes = Math.max(0, Number.isFinite(meshCount) ? meshCount : 0);
|
|
243
|
+
const grids = Math.max(0, Number.isFinite(gridCount) ? gridCount : 0);
|
|
244
|
+
const total = meshes + grids;
|
|
245
|
+
if (total > 1) return `${total} objects selected`;
|
|
246
|
+
if (grids === 1) return '1 grid line selected';
|
|
247
|
+
return '';
|
|
248
|
+
}
|
|
249
|
+
|
|
203
250
|
/**
|
|
204
251
|
* Re-key source-indexed labels to the sorted/deduplicated level order while retaining every
|
|
205
252
|
* non-empty label whose source elevation was dropped. Extras remain appended until the user
|
|
@@ -22,13 +22,14 @@ import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
|
22
22
|
import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf } from './steel-3d-core.js';
|
|
23
23
|
// `gridGeometry`, `gridCandidates3d` and `mmPerPx` moved behind the host's model read half (unit 5, P7d):
|
|
24
24
|
// each takes a `ptPerFt`, which is a v1 PLAN default and meaningless on a world-mm model grid.
|
|
25
|
-
import { visibleGridLevels } from './grid-core.js';
|
|
25
|
+
import { visibleGridLevels, gridTransientScopeSignature, reconcileGridTransientState, objectSelectionStatus } from './grid-core.js';
|
|
26
26
|
|
|
27
27
|
let renderer, scene, perspCam, orthoCam, camera, controls, root, api, canvasEl, ro, rafId, grid, raycaster, downXY, lastPick = '(none)';
|
|
28
28
|
let lightAmb, lightKey, lightFill; // dimmed in Realistic, where the environment lights the scene
|
|
29
29
|
let shadowGround = null, shadowsEnabled = false; // the `shadowed` mode's ground catcher + its compiled state
|
|
30
30
|
let pending = null, dragging = null, marker = null, readout = null; // pending = member gesture; readout = drag dimension overlay
|
|
31
31
|
let boxSel = null, rubber = null; // LEFT-drag-on-empty rubber-band multi-select
|
|
32
|
+
let selectionTrace = null; // last ordinary pointer-selection route (read-only E2E diagnostic)
|
|
32
33
|
let hoverId = null, hoverGlowIds = [], hoverChip = null, hoverRAF = 0, lastHoverXY = null; // hover readout + cursor; hoverGlowIds = every mesh currently wearing the sky glow (the WHOLE connection when hovering one of its parts)
|
|
33
34
|
let epGroup = null; // yellow/magenta endpoint markers (start/end direction dots)
|
|
34
35
|
let epGeom = null, epMatStart = null, epMatEnd = null; // shared across all endpoint dots (no per-rebuild churn)
|
|
@@ -72,6 +73,9 @@ const groupHidden = new Set(); // profile keys hidden via the legen
|
|
|
72
73
|
let soloGroups = new Set(); // profile keys isolated via the legend (dbl-click; Ctrl/Shift add to the set)
|
|
73
74
|
let isolatedIds = null; // Tekla "isolate selected": Set of ids shown exclusively, or null for off
|
|
74
75
|
let connHidden = new Set(); // explicit per-PART hide (legend connection rows) — lets a shared part-kind (weld/nut) hide per-connection by id, not per group
|
|
76
|
+
let selectionHidden = new Set(); // session-only per-mesh hide from the toolbar's Hide selected action; raw renderer ids never enter the tagged saved-view contract
|
|
77
|
+
let isolatedGridIds = null; // isolate-selected's logical grid-line half; null = no isolation, an empty Set intentionally hides every grid
|
|
78
|
+
let gridSelectionHidden = new Set(); // session-only logical grid lines hidden by Hide selected (never mutates the authored grid)
|
|
75
79
|
let cube = null; // ViewCube { renderer, scene, cam, mesh, faces }
|
|
76
80
|
let triad = null; // world-axis triad { renderer, scene, cam, group } — passive X/Y/Z readout
|
|
77
81
|
const DRAG_TOL_PX = 4; // movement past this = a drag (not a click)
|
|
@@ -884,12 +888,18 @@ function buildFromScene(sc) {
|
|
|
884
888
|
dimParts = (sc.elements || []).filter((el) => el && (el.kind === 'plate' || el.kind === 'cut'));
|
|
885
889
|
renderClipGizmo(); // re-anchor the selected clip's gizmo to the (possibly new) sceneBox after a rebuild
|
|
886
890
|
buildGrid(box);
|
|
891
|
+
// Reconcile mesh visibility BEFORE the structural grid: mixed member+grid isolation needs the
|
|
892
|
+
// grid reconciler to see the surviving mesh count, otherwise deleting the last isolated member
|
|
893
|
+
// while the grid changes can leave an empty grid isolation active indefinitely.
|
|
894
|
+
const hadVisibilityFilter = hasVisibilityFilter();
|
|
895
|
+
if (isolatedIds) { isolatedIds = new Set([...isolatedIds].filter((id) => meshById.has(id))); if (!isolatedIds.size && isolatedGridIds === null) isolatedIds = null; } // drop removed mesh ids; preserve the intentional empty mesh half of a surviving grid isolation, otherwise exit mesh-only isolation
|
|
896
|
+
if (connHidden.size) connHidden = new Set([...connHidden].filter((id) => meshById.has(id))); // drop per-part hides whose mesh an edit removed
|
|
897
|
+
if (selectionHidden.size) selectionHidden = new Set([...selectionHidden].filter((id) => meshById.has(id))); // drop transient hides whose mesh an edit removed
|
|
887
898
|
buildStructGrid();
|
|
888
899
|
buildRefLines();
|
|
889
900
|
syncMemberLabels(); // refresh the member-label pool from the (possibly edited) member set
|
|
890
901
|
syncPropLabels(); // re-anchor the property labels too (member geometry may have moved)
|
|
891
|
-
if (
|
|
892
|
-
if (connHidden.size) connHidden = new Set([...connHidden].filter((id) => meshById.has(id))); // drop per-part hides whose mesh an edit removed
|
|
902
|
+
if (hadVisibilityFilter !== hasVisibilityFilter()) notifyVisibilityChange(); // keep the host's recovery control honest when an edit removes the last hidden/isolated mesh
|
|
893
903
|
applyGroupVisibility(); applyDisplayMode();
|
|
894
904
|
built = true;
|
|
895
905
|
if (fitPending) { fitCamera(box); fitPending = false; } // fit only on entering 3D (rebuild(true)) — NOT on every edit
|
|
@@ -2038,6 +2048,7 @@ let structGridGroup = null, gridLabelGroup = null;
|
|
|
2038
2048
|
let gridLevelsMm = []; // world Zs the grid is DRAWN at (one per visible level) — set by buildStructGrid so grid snapping can never drift from what the user sees
|
|
2039
2049
|
const structGridLines = new Map();
|
|
2040
2050
|
let selectedGridIds = new Set();
|
|
2051
|
+
let structGridSignature = null;
|
|
2041
2052
|
const gridTexCache = new Map(); // 'b:LABEL' bubble / 't:LABEL' tag -> CanvasTexture (kept until dispose)
|
|
2042
2053
|
|
|
2043
2054
|
// Snap targets for the 3D tools. Members come from the WHOLE model — every sheet, not just the active
|
|
@@ -2110,23 +2121,24 @@ function clearStructGrid() {
|
|
|
2110
2121
|
structGridGroup = gridLabelGroup = null;structGridLines.clear();gridLevelsMm = [];
|
|
2111
2122
|
}
|
|
2112
2123
|
function buildStructGrid() {
|
|
2113
|
-
clearStructGrid();
|
|
2114
2124
|
dimCandidates3d = null; tfCandidates = null; clipCandidates = null; clipLevels = null; invalidateModelCache(); // the grid just changed → EVERY cached snap set built from the OLD one is stale (dim, Move/Copy + Add, clip-box draw). rebuild() already nulls these, but refresh3DGrid() (grid panel edits, and the plan switch setPlan now fires) reaches us without it, which would pair one sheet's grid X/Y with another's elevations.
|
|
2115
|
-
if (!api || !scene) return;
|
|
2116
2125
|
// THE GRID NEEDS ITS OWN v2 PATH, and this is the one place it shows (§8.3). v1's grid is stored in the
|
|
2117
2126
|
// active sheet's DISPLAY space — px, with Y growing DOWN the page — so the two conversions below are a
|
|
2118
2127
|
// scale AND a reflection. v2's grid is already world mm with Y up. Handing a world-mm grid to the v1
|
|
2119
2128
|
// conversion would not throw; it would draw the whole grid mirrored about Y, plausibly, at 1/12 scale.
|
|
2120
2129
|
// So the read half answers with the drawable geometry AND the two facts needed to place it.
|
|
2121
2130
|
let d = null;
|
|
2122
|
-
try { d = MODEL().gridDraw(); }
|
|
2123
|
-
catch (e) { console.warn('[steel-3d] grid skipped (bad grid data)', e);
|
|
2124
|
-
|
|
2131
|
+
try { if(api&&scene)d = MODEL().gridDraw(); }
|
|
2132
|
+
catch (e) { console.warn('[steel-3d] grid skipped (bad grid data)', e); }
|
|
2133
|
+
const nextSignature=gridTransientScopeSignature(api&&api.gridScopeKey?api.gridScopeKey():'',d),scopeChanged=structGridSignature!==null&&nextSignature!==structGridSignature;
|
|
2134
|
+
structGridSignature=nextSignature;clearStructGrid();
|
|
2135
|
+
const finish=()=>{reconcileGridVisibilityState(scopeChanged);applyGridVisibility();};
|
|
2136
|
+
if (!api || !scene || !d) {finish();return;} // no grid, switched off, or bad grid data
|
|
2125
2137
|
const { g, geo, k, flipY } = d;
|
|
2126
|
-
if (!geo.v.length && !geo.h.length && !(geo.lines && geo.lines.length)) return;
|
|
2138
|
+
if (!geo.v.length && !geo.h.length && !(geo.lines && geo.lines.length)) {finish();return;}
|
|
2127
2139
|
const mmX = (u) => u * k, mmY = (u) => (flipY ? -u : u) * k; // stored space → scene
|
|
2128
2140
|
const levels = geo.zs.length ? visibleGridLevels(geo.zs, g.hidden_z) : [{ mm: 0, label: '0' }];
|
|
2129
|
-
if (!levels.length) return;
|
|
2141
|
+
if (!levels.length) {finish();return;} // every authored Z datum is hidden
|
|
2130
2142
|
gridLevelsMm = levels.map((lv) => lv.mm); // the planes grid snapping evaluates on — same list, same order as what gets drawn below
|
|
2131
2143
|
structGridGroup = new THREE.Group();
|
|
2132
2144
|
// Drawn at the level's TRUE Z. It used to sit 25 mm under it ("no z-fight/burial"), but the snap
|
|
@@ -2156,6 +2168,7 @@ function buildStructGrid() {
|
|
|
2156
2168
|
(geo.lines || []).forEach((l,i)=>{const id='gl:'+(l.id!=null?l.id:i);sprite(gridBubbleTexture(l.label), mmX(l.a[0]), mmY(l.a[1]), z0, dia, dia,l.label,id); sprite(gridBubbleTexture(l.label), mmX(l.b[0]), mmY(l.b[1]), z0, dia, dia,l.label,id);});
|
|
2157
2169
|
if (geo.zs.length) for (const lv of levels) sprite(gridTagTexture(lv.label), mmX(geo.x0), mmY(geo.y1), lv.mm, dia * 4.8, dia * 0.75,lv.label); // 6.4:1 sprite matches the tag texture, so long elevation labels stay undistorted
|
|
2158
2170
|
overlayScene.add(gridLabelGroup);
|
|
2171
|
+
finish();
|
|
2159
2172
|
}
|
|
2160
2173
|
|
|
2161
2174
|
// The ortho frustum half-height in world units (set by a fit to the box, or by a projection toggle
|
|
@@ -2439,7 +2452,7 @@ function visibleIgnoringWorkArea(m) {
|
|
|
2439
2452
|
const k = m.userData && m.userData.group;
|
|
2440
2453
|
const byGroup = !groupHidden.has(k) && (soloGroups.size === 0 || soloGroups.has(k));
|
|
2441
2454
|
const byIso = isolatedIds === null || isolatedIds.has(m.userData.id); // isolate-selected: only the isolated ids show
|
|
2442
|
-
return byGroup && byIso && !connHidden.has(m.userData.id);
|
|
2455
|
+
return byGroup && byIso && !connHidden.has(m.userData.id) && !selectionHidden.has(m.userData.id);
|
|
2443
2456
|
}
|
|
2444
2457
|
function applyGroupVisibility() {
|
|
2445
2458
|
for (const m of meshById.values()) m.visible = visibleIgnoringWorkArea(m) && meshInWorkArea(m); // meshInWorkArea: work-area whole-parts spatial filter
|
|
@@ -2449,17 +2462,24 @@ function visibleMemberIds() {
|
|
|
2449
2462
|
for (const [id, m] of meshById) if (m.visible && !m.userData.derived) out.push(id);
|
|
2450
2463
|
return out;
|
|
2451
2464
|
}
|
|
2452
|
-
function
|
|
2465
|
+
function visibleObjectIds() {
|
|
2466
|
+
const out = [];
|
|
2467
|
+
for (const [id, m] of meshById) if (m.visible) out.push(id);
|
|
2468
|
+
return out;
|
|
2469
|
+
}
|
|
2470
|
+
function visibleGridIds() { return [...structGridLines].filter(([, line]) => line.visible).map(([id]) => id); }
|
|
2471
|
+
function notifyVisibilityChange() { if (api && api.onIsolateChange) api.onIsolateChange(isolatedIds !== null || isolatedGridIds !== null); }
|
|
2472
|
+
function toggleGroup(k) { if (groupHidden.has(k)) groupHidden.delete(k); else groupHidden.add(k); soloGroups.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2453
2473
|
// Hide/show a SET of groups in one pass (a legend type-category master toggle) — deterministic (not a flip),
|
|
2454
2474
|
// so "hide all" / "show all" for the category is exact. Clears solo, like toggleGroup.
|
|
2455
|
-
function setGroupsHidden(keys, hidden) {
|
|
2475
|
+
function setGroupsHidden(keys, hidden) { const target = new Set(keys || []); for (const k of target) { if (hidden) groupHidden.add(k); else groupHidden.delete(k); } if (!hidden && selectionHidden.size) selectionHidden = new Set([...selectionHidden].filter((id) => { const m = meshById.get(id); return !m || !target.has(m.userData && m.userData.group); })); soloGroups.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2456
2476
|
// Hide/show specific PART ids (a legend connection row / connection master). Per-id so a connection's own
|
|
2457
2477
|
// nuts/welds toggle independently of the other connection's (the part-kind group is shared across joints).
|
|
2458
|
-
function setIdsHidden(ids, hidden) { for (const id of (ids || [])) { if (hidden) connHidden.add(id); else connHidden.delete(id); } applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); }
|
|
2478
|
+
function setIdsHidden(ids, hidden) { for (const id of (ids || [])) { if (hidden) connHidden.add(id); else { connHidden.delete(id); selectionHidden.delete(id); } } applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2459
2479
|
// Isolate an explicit SET of profile groups (the editor's legend builds it from Ctrl/Shift dbl-clicks, Explorer-style).
|
|
2460
|
-
function setSoloGroups(keys) { soloGroups = new Set((keys || []).filter((k) => k != null)); if (soloGroups.size) groupHidden.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); }
|
|
2480
|
+
function setSoloGroups(keys) { soloGroups = new Set((keys || []).filter((k) => k != null)); if (soloGroups.size) groupHidden.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2461
2481
|
function soloToggle(k) { setSoloGroups(soloGroups.size === 1 && soloGroups.has(k) ? [] : [k]); } // plain dbl-click: isolate just this group (or clear if it's already the only one)
|
|
2462
|
-
function showAllGroups() { groupHidden.clear(); soloGroups.clear(); isolatedIds = null; connHidden.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims();
|
|
2482
|
+
function showAllGroups() { groupHidden.clear(); soloGroups.clear(); isolatedIds = null; isolatedGridIds = null; connHidden.clear(); selectionHidden.clear(); gridSelectionHidden.clear(); applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); }
|
|
2463
2483
|
function groupState() { return { hidden: [...groupHidden], solo: [...soloGroups] }; }
|
|
2464
2484
|
// One serialisable snapshot of the objects-list pane's PERSISTENT visibility state — group hide/solo +
|
|
2465
2485
|
// isolate-selected + per-part legend hides. This is what a saved view (Views Organizer) captures; it
|
|
@@ -2475,14 +2495,20 @@ function applyObjectsPaneState(s) {
|
|
|
2475
2495
|
soloGroups = new Set(Array.isArray(s.solo) ? s.solo : []);
|
|
2476
2496
|
isolatedIds = (Array.isArray(s.isolated) && s.isolated.length) ? new Set(s.isolated) : null;
|
|
2477
2497
|
connHidden = new Set(Array.isArray(s.connHidden) ? s.connHidden : []);
|
|
2478
|
-
|
|
2479
|
-
|
|
2498
|
+
selectionHidden.clear(); // Hide selected is session-only; applying a saved view restores its authored persistent visibility without leaking the current session filter
|
|
2499
|
+
gridSelectionHidden.clear(); isolatedGridIds = isolatedIds === null ? null : new Set(); // saved member-only isolation still means "only these objects"; raw logical-grid ids remain session-only
|
|
2500
|
+
applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims();
|
|
2501
|
+
notifyVisibilityChange();
|
|
2480
2502
|
}
|
|
2481
2503
|
// Tekla "isolate selected": show ONLY the currently-selected parts (a snapshot taken now — distinct from
|
|
2482
2504
|
// soloToggle, which isolates a whole PROFILE group from the legend). clearIsolation / showAllGroups restore all.
|
|
2483
|
-
function isolateSelected() { if (!selIds.size) return false; isolatedIds = new Set(selIds); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip();
|
|
2484
|
-
|
|
2485
|
-
|
|
2505
|
+
function isolateSelected() { if (!selIds.size && !selectedGridIds.size) return false; isolatedIds = new Set(selIds); isolatedGridIds = new Set(selectedGridIds); applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); return true; }
|
|
2506
|
+
// Hide the current selection by explicit mesh id. This remains session-only because v2 saved views require tagged
|
|
2507
|
+
// SceneRefs while the renderer owns raw ids; broadening that contract is a separate migration, not toolbar state.
|
|
2508
|
+
function hideSelected() { const ids = [...selIds].filter((id) => meshById.has(id)), gridIds = [...selectedGridIds].filter((id) => structGridLines.has(id)); if (!ids.length && !gridIds.length) return 0; for (const id of ids) selectionHidden.add(id); for (const id of gridIds) gridSelectionHidden.add(id); applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); return ids.length + gridIds.length; }
|
|
2509
|
+
function clearIsolation() { if (isolatedIds === null && isolatedGridIds === null) return; isolatedIds = null; isolatedGridIds = null; applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); }
|
|
2510
|
+
function isIsolated() { return isolatedIds !== null || isolatedGridIds !== null; }
|
|
2511
|
+
function hasVisibilityFilter() { return isolatedIds !== null || isolatedGridIds !== null || groupHidden.size > 0 || soloGroups.size > 0 || connHidden.size > 0 || selectionHidden.size > 0 || gridSelectionHidden.size > 0; }
|
|
2486
2512
|
function getGroups() { return sceneGroups.map((g) => ({ ...g })); }
|
|
2487
2513
|
|
|
2488
2514
|
// ---- clip planes / clip boxes (Tekla-style sectioning) ----
|
|
@@ -2996,7 +3022,7 @@ function onKey(e) {
|
|
|
2996
3022
|
if (insertMode && e.key === 'Escape') { e.preventDefault(); setInsertMode(false); if (api && api.toast) api.toast('Insert cancelled'); return; } // Esc disarms the detail-placement pick
|
|
2997
3023
|
if (basePickCol && e.key === 'Escape') { e.preventDefault(); setBasePickMode(null); if (api && api.toast) api.toast('Trim cancelled'); return; } // Esc disarms the Mode B column-base pick
|
|
2998
3024
|
if (clipMode && e.key === 'Escape') { e.preventDefault(); if (clipMode === 'box' && clipBoxDraft) { if (clipBoxDraft.b) clipBoxDraft.b = null; else clipBoxDraft = null; setClipPreview(null); if (marker) marker.visible = false; updateStatusChip(); } else setClipMode(null); return; } // Esc steps back: height→footprint→cancel, else disarms the pick
|
|
2999
|
-
if (
|
|
3025
|
+
if (isIsolated() && e.key === 'Escape' && !dimMode3d) { e.preventDefault(); clearIsolation(); return; } // Esc exits isolate-selected (the dim tool's own Esc wins while it's armed)
|
|
3000
3026
|
// Esc ascends the REFERENCE drill: one object → the whole reference. ONE RUNG ONLY — unlike the
|
|
3001
3027
|
// connection ladder below, which is part → whole → nothing. A reference is borrowed geometry you keep
|
|
3002
3028
|
// selected while you build against it, so Esc stops at the reference rather than clearing it; the
|
|
@@ -3801,7 +3827,22 @@ function pickGridAt(cx,cy){
|
|
|
3801
3827
|
return best;
|
|
3802
3828
|
}
|
|
3803
3829
|
|
|
3804
|
-
function
|
|
3830
|
+
function applyGridVisibility(){
|
|
3831
|
+
let anyLine=false;
|
|
3832
|
+
for(const [id,line] of structGridLines){const on=(isolatedGridIds===null||isolatedGridIds.has(id))&&!gridSelectionHidden.has(id);line.visible=on;if(on)anyLine=true;}
|
|
3833
|
+
if(gridLabelGroup)for(const label of gridLabelGroup.children){const id=label.userData&&label.userData.gridId;label.visible=id?((isolatedGridIds===null||isolatedGridIds.has(id))&&!gridSelectionHidden.has(id)):anyLine;}
|
|
3834
|
+
}
|
|
3835
|
+
function reconcileGridVisibilityState(scopeChanged=false){
|
|
3836
|
+
const next=reconcileGridTransientState({
|
|
3837
|
+
selected:[...selectedGridIds],hidden:[...gridSelectionHidden],isolated:isolatedGridIds===null?null:[...isolatedGridIds],
|
|
3838
|
+
meshIsolationCount:isolatedIds===null?0:isolatedIds.size,
|
|
3839
|
+
},[...structGridLines.keys()],scopeChanged);
|
|
3840
|
+
selectedGridIds=new Set(next.selected);gridSelectionHidden=new Set(next.hidden);isolatedGridIds=next.isolated===null?null:new Set(next.isolated);
|
|
3841
|
+
if(next.clearMeshIsolation){isolatedIds=null;applyGroupVisibility();rebuildEndpoints();refreshOverlayDims();refreshDims();}
|
|
3842
|
+
if(next.selectionChanged&&api&&api.onGridSelectionReset)api.onGridSelectionReset();
|
|
3843
|
+
if(next.changed){updateStatusChip();notifyVisibilityChange();}
|
|
3844
|
+
}
|
|
3845
|
+
function setGridSelection(ids){selectedGridIds=ids instanceof Set?new Set(ids):new Set(ids||[]);for(const [id,line] of structGridLines){line.material.color.setHex(selectedGridIds.has(id)?0x3b82f6:0x64748b);line.material.opacity=selectedGridIds.has(id)?1:0.85;}updateStatusChip();}
|
|
3805
3846
|
// Raycast ALL visible meshes — members AND derived connection parts — at a client point → ids
|
|
3806
3847
|
// front-to-back (nearest first), deduped. Backs click-to-cycle so a small plate/bolt/weld stacked on a
|
|
3807
3848
|
// beam at a joint is reachable without a modifier (D). pickAt stays members-only — the down-gesture
|
|
@@ -3821,6 +3862,7 @@ const CYCLE_TOL_PX = 8;
|
|
|
3821
3862
|
function resetCycle() { cycleAnchor = null; cycleIds = []; cycleIdx = 0; }
|
|
3822
3863
|
function clickSelect(cx, cy, ctrl) {
|
|
3823
3864
|
let hits = []; try { hits = pickAllAt(cx, cy); } catch { hits = []; }
|
|
3865
|
+
selectionTrace={phase:'up-pick',x:cx,y:cy,ownHits:hits.slice(0,4)};
|
|
3824
3866
|
if (hits.length) selectReference(null); // anything of OURS under the cursor drops a reference selection
|
|
3825
3867
|
if (!hits.length) {
|
|
3826
3868
|
// Nothing of ours here — only NOW may a reference answer. Consulted second, never first, so a
|
|
@@ -3831,7 +3873,12 @@ function clickSelect(cx, cy, ctrl) {
|
|
|
3831
3873
|
// stacked inside a connection, and it is free here: the modifier's other meaning (additive select)
|
|
3832
3874
|
// belongs to the branch above, which this arm is only ever reached instead of.
|
|
3833
3875
|
let ref = null; try { ref = pickReferenceAt(cx, cy); } catch { ref = null; }
|
|
3876
|
+
selectionTrace={...selectionTrace,reference:ref,referenceAllowed:!api||!api.canSelectReference||api.canSelectReference()};
|
|
3834
3877
|
if (ref) {
|
|
3878
|
+
// A filtered class is inert: hitting it must not be reinterpreted as empty canvas, because that
|
|
3879
|
+
// would clear the selection the user already has. Selection filtering and visibility remain
|
|
3880
|
+
// independent, just as they are for native members.
|
|
3881
|
+
if (api && api.canSelectReference && !api.canSelectReference()) return;
|
|
3835
3882
|
resetCycle();
|
|
3836
3883
|
// The drill FALLS BACK to selecting the whole reference when the object cannot be addressed
|
|
3837
3884
|
// (`objectIndex` -1 from a mesh built before this existed). Refusing outright would make Ctrl+click
|
|
@@ -4431,6 +4478,7 @@ const tfLock = new Set(); // subset of {'u','v','n'} the move is LINE-loc
|
|
|
4431
4478
|
let tfCandidates = null;
|
|
4432
4479
|
let tfGhost = null, tfRubber = null, tfRubberA = null, tfGhostMat = null;
|
|
4433
4480
|
const cmActive = () => (api && api.cmState ? api.cmState() : null);
|
|
4481
|
+
const cmTargetPresent = (st) => !!(selIds.size || (st && st.tool === 'move' && st.referenceId && xrefSelected === st.referenceId && !xrefSubSelected));
|
|
4434
4482
|
const cmHasBase = () => !!tfDraft;
|
|
4435
4483
|
const cmLastClient = () => tfLastClient;
|
|
4436
4484
|
// X/Y/Z each TOGGLE their axis in the lock set (press again to release, press another to ADD → the move
|
|
@@ -4557,7 +4605,11 @@ function tfGhostBuild(offs) {
|
|
|
4557
4605
|
tfDisposeGhost(); // dispose the previous rebuild's own geometries (the >600 boxes) before dropping it
|
|
4558
4606
|
tfGhost = new THREE.Group();
|
|
4559
4607
|
if (!tfGhostMat) { tfGhostMat = new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.3, depthWrite: false }); }
|
|
4560
|
-
const sel = [...selIds].map((id) => meshById.get(id)).filter((m) => m && m.visible);
|
|
4608
|
+
const st = cmActive(), sel = [...selIds].map((id) => meshById.get(id)).filter((m) => m && m.visible);
|
|
4609
|
+
if (!sel.length && st && st.referenceId === xrefSelected && !xrefSubSelected) {
|
|
4610
|
+
const entry = xrefById.get(st.referenceId);
|
|
4611
|
+
if (entry && entry.group.visible) entry.group.traverse((m) => { if (m.isMesh && m.visible) sel.push(m); });
|
|
4612
|
+
}
|
|
4561
4613
|
if (sel.length * offs.length <= 600) {
|
|
4562
4614
|
for (const off of offs) for (const m of sel) {
|
|
4563
4615
|
const c = new THREE.Mesh(m.geometry, tfGhostMat); // shares the source geometry — nothing to dispose
|
|
@@ -4597,7 +4649,7 @@ function tfPreview(e) {
|
|
|
4597
4649
|
}
|
|
4598
4650
|
function tfClick(e) {
|
|
4599
4651
|
const st = cmActive(); if (!st) return false;
|
|
4600
|
-
if (!
|
|
4652
|
+
if (!cmTargetPresent(st)) { // selection drained while armed (undo/delete) — end the tool and let the click SELECT instead
|
|
4601
4653
|
if (api && api.toast) api.toast('Selection is empty — ' + (st.tool === 'move' ? 'Move' : 'Copy') + ' ended');
|
|
4602
4654
|
if (api && api.disarmTransform) api.disarmTransform();
|
|
4603
4655
|
return false;
|
|
@@ -4949,6 +5001,10 @@ function onDown(e) {
|
|
|
4949
5001
|
}
|
|
4950
5002
|
let gridHit=null,allMeshHits=[];try{gridHit=pickGridAt(e.clientX,e.clientY);}catch(err){console.error('steel-3d: grid hit-test failed',err);}try{allMeshHits=meshHitsAt(e.clientX,e.clientY);}catch(err){console.error('steel-3d: mesh hit-test failed',err);}const gridAllowed=!api||!api.canSelectGrid||api.canSelectGrid(),gridOccluders=OPAQUE_MODES.has(displayMode)?allMeshHits.filter(occludesGrid):[],meshDepth=gridOccluders.length?gridOccluders[0].point.clone().project(camera).z:Infinity,gridInFront=gridHit&&gridDepthWins(gridHit.depth,meshDepth);if(gridHit&&!gridAllowed&&gridInFront){e.stopPropagation();controls.enabled=false;pending={filteredGrid:true};return;} // Deliberately consume the LEFT select gesture like 2D when the visible grid is frontmost: a filtered grid stays inert and preserves selection. RIGHT-drag orbit is a separate handler.
|
|
4951
5003
|
const gridWins=gridAllowed&&gridHit&&gridInFront;if(gridWins){e.stopPropagation();controls.enabled=false;pending={gridId:gridHit.id,add:e.ctrlKey||e.metaKey||e.shiftKey};return;} // Compare projected depth in Solid; Wire/X-ray fills do not write depth and therefore cannot phantom-occlude a visible grid.
|
|
5004
|
+
// Consume a filtered reference on DOWN, before it can become an empty-space box/click gesture. The
|
|
5005
|
+
// up-side picker repeats this guard defensively, but a real pointer lifecycle may otherwise clear the
|
|
5006
|
+
// current native selection before that late raycast gets a vote.
|
|
5007
|
+
if(!id&&api&&api.canSelectReference&&!api.canSelectReference()){let filteredRef=null;try{filteredRef=pickReferenceAt(e.clientX,e.clientY);}catch{}selectionTrace={phase:'down-filter',x:e.clientX,y:e.clientY,own:id,reference:filteredRef,referenceAllowed:false};if(filteredRef){e.stopPropagation();controls.enabled=false;pending={filteredReference:true};return;}}
|
|
4952
5008
|
if (!id) { pending = null; boxSel = { x: e.clientX, y: e.clientY }; return; } // empty space → box-select on drag
|
|
4953
5009
|
e.stopPropagation(); controls.enabled = false; // grabbed a member → suppress orbit (enabled=false is the reliable guard)
|
|
4954
5010
|
try {
|
|
@@ -5199,7 +5255,7 @@ function onMove(e) {
|
|
|
5199
5255
|
if (pending && pending.clipDrag) { onMoveClip(e); return; } // dragging a clip handle (plane offset / box face)
|
|
5200
5256
|
if (pending && pending.frameDrag) { onMoveFrame(e); return; } // dragging the local-frame origin / rotation ring
|
|
5201
5257
|
if (!pending || pending.geo) return;
|
|
5202
|
-
if (pending.gridId||pending.filteredGrid) { const d=Math.hypot(e.clientX-downXY[0],e.clientY-downXY[1]);if(d<=DRAG_TOL_PX)return;pending=null;controls.enabled=true;boxSel={x:downXY[0],y:downXY[1]};onBoxMove(e);return; } //
|
|
5258
|
+
if (pending.gridId||pending.filteredGrid||pending.filteredReference) { const d=Math.hypot(e.clientX-downXY[0],e.clientY-downXY[1]);if(d<=DRAG_TOL_PX)return;pending=null;controls.enabled=true;boxSel={x:downXY[0],y:downXY[1]};onBoxMove(e);return; } // a filtered-reference/grid click stays inert, but once it moves the same press becomes a normal marquee so an overlay cannot blanket-disable box selection
|
|
5203
5259
|
if (pending.epDrag) { onMoveEndpoint(e); return; }
|
|
5204
5260
|
if (!pending.grab || !pending.origMm) return;
|
|
5205
5261
|
if (!dragging && Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) <= DRAG_TOL_PX) return;
|
|
@@ -5307,7 +5363,7 @@ const gridPlaneSpecs=planes=>(planes||[]).map(p=>({normal:[p.normal.x,p.normal.y
|
|
|
5307
5363
|
function visibleGridSegment(a,b){return clipSegmentToPlanes(a,b,gridPlaneSpecs(renderer&&renderer.clippingPlanes));}
|
|
5308
5364
|
function gridCameraFrustum(){camera.updateMatrixWorld();return new THREE.Frustum().setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse));}
|
|
5309
5365
|
function cameraVisibleGridSegment(p,frustum){return clipSegmentToPlanes(p[0],p[1],gridPlaneSpecs(frustum&&frustum.planes));}
|
|
5310
|
-
function gridsInRect(x0,y0,x1,y1,windowMode){const rect=canvasEl.getBoundingClientRect(),r=[Math.min(x0,x1),Math.min(y0,y1),Math.max(x0,x1),Math.max(y0,y1)],out=[],frustum=gridCameraFrustum();const screen=p=>{const v=new THREE.Vector3(...p).project(camera);return Number.isFinite(v.x)&&Number.isFinite(v.y)?[rect.left+(v.x*.5+.5)*rect.width,rect.top+(-v.y*.5+.5)*rect.height]:null;};for(const [id,line] of structGridLines){const pts=line.userData.segments||[];let hit=false;for(let i=0;i+1<pts.length;i+=2){const sectionVisible=visibleGridSegment(pts[i],pts[i+1]),vis=sectionVisible&&cameraVisibleGridSegment(sectionVisible,frustum);if(!vis)continue;const a=screen(vis[0]),b=screen(vis[1]);if(!a||!b)continue;if(segmentHitsRect2d(a,b,r,windowMode)){hit=true;break;}}if(hit)out.push(id);}return out;} // Keep raw hits even when grid selection is filtered off; the host batch filter uses them to make filtered-only marquees inert instead of clearing the current selection.
|
|
5366
|
+
function gridsInRect(x0,y0,x1,y1,windowMode){const rect=canvasEl.getBoundingClientRect(),r=[Math.min(x0,x1),Math.min(y0,y1),Math.max(x0,x1),Math.max(y0,y1)],out=[],frustum=gridCameraFrustum();const screen=p=>{const v=new THREE.Vector3(...p).project(camera);return Number.isFinite(v.x)&&Number.isFinite(v.y)?[rect.left+(v.x*.5+.5)*rect.width,rect.top+(-v.y*.5+.5)*rect.height]:null;};for(const [id,line] of structGridLines){if(!line.visible)continue;const pts=line.userData.segments||[];let hit=false;for(let i=0;i+1<pts.length;i+=2){const sectionVisible=visibleGridSegment(pts[i],pts[i+1]),vis=sectionVisible&&cameraVisibleGridSegment(sectionVisible,frustum);if(!vis)continue;const a=screen(vis[0]),b=screen(vis[1]);if(!a||!b)continue;if(segmentHitsRect2d(a,b,r,windowMode)){hit=true;break;}}if(hit)out.push(id);}return out;} // Keep visible raw hits even when grid selection is filtered off; the host batch filter uses them to make filtered-only marquees inert instead of clearing the current selection. Visibility-hidden grids never become phantom box hits.
|
|
5311
5367
|
// Connection Components whose screen footprint (projected bbox) meets a marquee rect — so area-select picks
|
|
5312
5368
|
// up connections, not just members. window: the whole footprint enclosed · crossing: it overlaps the rect.
|
|
5313
5369
|
function connsInRect(x0, y0, x1, y1, windowMode) {
|
|
@@ -5382,7 +5438,7 @@ function onUp(e) {
|
|
|
5382
5438
|
controls.enabled = true;
|
|
5383
5439
|
const moved = downXY ? Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) : Infinity; downXY = null;
|
|
5384
5440
|
if (!p) return;
|
|
5385
|
-
if(p.filteredGrid)return;
|
|
5441
|
+
if(p.filteredGrid||p.filteredReference)return;
|
|
5386
5442
|
if(p.gridId){if(moved>DRAG_TOL_PX)return;if(!p.add)resetConnState();if(api&&api.onSelectBatch)api.onSelectBatch({memberIds:[],gridIds:[p.gridId]},p.add);else if(api&&api.onSelectGrid)api.onSelectGrid(p.gridId,p.add);return;}
|
|
5387
5443
|
if (p.clipDrag) return; // a clip handle drag is applied live during onMoveClip; nothing to commit on up (controls re-enabled above)
|
|
5388
5444
|
if (p.frameDrag) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; tfCandidates = null; dimCandidates3d = null; return; } // local-frame origin/rotation is applied live during onMoveFrame; session-only, nothing to commit — clear the snap marker/readout AND re-null the snap caches (they were rebuilt sans the UCS origin during the drag) so the next Move/Dimension snaps TO the moved origin again (code-review)
|
|
@@ -5586,7 +5642,7 @@ function updateStatusChip() {
|
|
|
5586
5642
|
if (!hoverChip || !canvasEl) return;
|
|
5587
5643
|
const rect = canvasEl.getBoundingClientRect();
|
|
5588
5644
|
let txt = '';
|
|
5589
|
-
const showId
|
|
5645
|
+
const selectionStatus=objectSelectionStatus(selIds.size,selectedGridIds.size),showId=hoverId||(!selectionStatus&&selIds.size===1?[...selIds][0]:null);
|
|
5590
5646
|
// The badge follows the cursor and so clips away at the window edge — from there this chip is the
|
|
5591
5647
|
// only thing still telling the user what releasing will do.
|
|
5592
5648
|
if (teklaDrag && teklaDrag.active) {
|
|
@@ -5614,8 +5670,9 @@ function updateStatusChip() {
|
|
|
5614
5670
|
else if (clipMode === 'plane') txt = 'Click a face to set a clip plane · Esc to cancel';
|
|
5615
5671
|
else if (clipMode === 'box') txt = !clipBoxDraft ? 'Click the first floor corner of the clip box · Esc to cancel' : !clipBoxDraft.b ? 'Click the opposite floor corner · Esc to cancel' : 'Move up/down to set the height, then click · Esc to step back';
|
|
5616
5672
|
else if (showId) { const m = memberById(showId); txt = m ? `${m.id} · ${m.profile || '—'}` : ''; }
|
|
5617
|
-
else if (
|
|
5618
|
-
else if (
|
|
5673
|
+
else if (selectionStatus) txt = selectionStatus;
|
|
5674
|
+
else if (isIsolated()) txt = `Isolated: ${(isolatedIds ? isolatedIds.size : 0) + (isolatedGridIds ? isolatedGridIds.size : 0)} · Show all to restore`;
|
|
5675
|
+
else if (selectionHidden.size || gridSelectionHidden.size) txt = `${selectionHidden.size + gridSelectionHidden.size} objects hidden · Show all to restore`;
|
|
5619
5676
|
// A read-only host (the vector 3D viewer) supplies its own idle hint — the default speaks editing
|
|
5620
5677
|
// verbs (move/stretch/elevate) a viewer's no-op api would silently ignore. Otherwise the default
|
|
5621
5678
|
// tells the truth about the drag-move/copy toggle (ON = drag-move + Ctrl-drag-copy; OFF = click-select).
|
|
@@ -5741,7 +5798,8 @@ function debug() {
|
|
|
5741
5798
|
// the pixels valid. Exists so a MATERIAL change can be checked by looking at it, not only by
|
|
5742
5799
|
// asserting on state — the whole point of Realistic is how it looks.
|
|
5743
5800
|
snapshot: (quality = 0.82) => { renderer.render(scene, camera); return canvasEl.toDataURL('image/jpeg', quality); },
|
|
5744
|
-
hidden: [...groupHidden], solo: [...soloGroups], isolated: isolatedIds ? [...isolatedIds] : null, visible: [...meshById.values()].filter((m) => m.visible).length,
|
|
5801
|
+
hidden: [...groupHidden], solo: [...soloGroups], isolated: isolatedIds ? [...isolatedIds] : null, selectionHidden: [...selectionHidden], gridIsolated: isolatedGridIds === null ? null : [...isolatedGridIds], gridSelectionHidden: [...gridSelectionHidden], visible: [...meshById.values()].filter((m) => m.visible).length,
|
|
5802
|
+
selected: [...selIds], selectedGrids: [...selectedGridIds], derivedIds: [...meshById].filter(([,m])=>m.userData&&m.userData.derived).map(([id])=>id),
|
|
5745
5803
|
endpoints: epGroup ? epGroup.children.length : 0,
|
|
5746
5804
|
endpointColors: epGroup ? epGroup.children.map((c) => '#' + c.material.color.getHexString()) : [],
|
|
5747
5805
|
hoverId, hoverGlowIds: [...hoverGlowIds], hoverEp, dragEp, refLine: refLineOn, // hoverGlowIds = the group the hover glow is computed over (whole connection at root, one part once drilled) — hoverId alone can't show that grouping. Selection still beats hover, so a selected id in this set glows brand blue, not sky
|
|
@@ -5755,6 +5813,7 @@ function debug() {
|
|
|
5755
5813
|
clips: getClips(), clipPlaneCount: renderer && renderer.clippingPlanes ? renderer.clippingPlanes.length : 0, clipMode, workArea: workAreaState(), selectedClips: [...selectedClipIds],
|
|
5756
5814
|
workPlane: workPlaneInfo(), tfHasBase: !!tfDraft, tfGhosts: tfGhost ? tfGhost.children.length : 0, drHasStart: !!drDraft,
|
|
5757
5815
|
wp: { origin: [...effectiveWP().origin], normal: [...effectiveWP().normal] }, // resolved working plane (◇ Plane, local UCS, or default level) — lets an E2E pick an off-plane vertex + assert the workplane-only snap constraint
|
|
5816
|
+
selectionTrace, selectedIds:[...selIds],
|
|
5758
5817
|
};
|
|
5759
5818
|
}
|
|
5760
5819
|
// test helper: the current material colour + emissive of a member (verifies deselect restores colour)
|
|
@@ -5823,6 +5882,9 @@ function referenceObjectsScreen(refId, opts) {
|
|
|
5823
5882
|
}
|
|
5824
5883
|
return out;
|
|
5825
5884
|
}
|
|
5885
|
+
// Read-only E2E diagnostic for the exact ordinary-selection raycasts at one client pixel. This keeps
|
|
5886
|
+
// browser verification on the real picker without exposing or mutating selection state.
|
|
5887
|
+
function selectionHitAtScreen(x,y){let own=null,ref=null;try{own=pickAt(x,y);}catch{}try{ref=pickReferenceAt(x,y);}catch{}return {own,reference:ref,referenceAllowed:!api||!api.canSelectReference||api.canSelectReference(),pending:pending?{filteredReference:!!pending.filteredReference,filteredGrid:!!pending.filteredGrid}:null,box:!!boxSel};}
|
|
5826
5888
|
// test helper: projected, clip-trimmed structural-grid segments. E2E uses these coordinates to drive a
|
|
5827
5889
|
// real line click / marquee without guessing where an oblique 3D line landed after camera fitting.
|
|
5828
5890
|
function gridSegmentsScreen() {
|
|
@@ -5858,6 +5920,7 @@ window.Steel3DView = {
|
|
|
5858
5920
|
refMeasureLabelText: () => (refMeasureLabel && refMeasureLabel.style.display !== 'none' ? refMeasureLabel.textContent : null),
|
|
5859
5921
|
refMeasureLineOn: () => !!(refMeasureLine && refMeasureLine.visible),
|
|
5860
5922
|
refMeasurePointAtScreen: (x, y) => refMeasurePointAt({ clientX: x, clientY: y }), // test probe: what WOULD snap at a cursor — read-only, no pick
|
|
5923
|
+
selectionHitAtScreen,
|
|
5861
5924
|
refCandidateCount: (id) => referenceCandidates(id).length, // test probe: how many points the restricted set offers
|
|
5862
5925
|
// TEST PROBE FOR THE RESTRICTION ITSELF, and it exists because nothing else can see it: swap
|
|
5863
5926
|
// referenceCandidates(refId) for allCandidates(null) and every other assertion in this feature still
|
|
@@ -5875,14 +5938,14 @@ window.Steel3DView = {
|
|
|
5875
5938
|
epScreen: (id) => { const m = memberById(id); if (!m || !canvasEl) return null; const g = geoOf(m); const rect = canvasEl.getBoundingClientRect(); const proj = (p) => { const v = new THREE.Vector3(p[0], p[1], p[2]).project(camera); return { x: rect.left + (v.x * 0.5 + 0.5) * rect.width, y: rect.top + (-v.y * 0.5 + 0.5) * rect.height }; }; return { a: proj(g.line[0]), b: proj(g.line[1]) }; }, // project a member's endpoints to viewport px — test probe for endpoint-drag tests
|
|
5876
5939
|
refreshGrid: buildStructGrid, // grid edited in the panel → re-render without a full rebuild
|
|
5877
5940
|
armGridLinePick3d, gridLinePick3dState: () => (gridLinePick3d ? { armed: true, hasFirst: !!gridLinePick3d.a, a: gridLinePick3d.a || null } : { armed: false, hasFirst: false, a: null }), // grid panel "Add single line" in 3D (+ test probe)
|
|
5878
|
-
gridInfo: () => ({ lines: structGridLines.size, labels: gridLabelGroup ? gridLabelGroup.children.length : 0,labelTexts:gridLabelGroup?[...new Set(gridLabelGroup.children.map(s=>s.userData.label).filter(Boolean))]:[],selected:[...selectedGridIds],ids:[...structGridLines.keys()] }), // test helper
|
|
5941
|
+
gridInfo: () => ({ lines: structGridLines.size, labels: gridLabelGroup ? gridLabelGroup.children.length : 0,labelTexts:gridLabelGroup?[...new Set(gridLabelGroup.children.map(s=>s.userData.label).filter(Boolean))]:[],selected:[...selectedGridIds],ids:[...structGridLines.keys()],visible:visibleGridIds(),hidden:[...gridSelectionHidden],isolated:isolatedGridIds===null?null:[...isolatedGridIds] }), // test helper
|
|
5879
5942
|
wpProbe: () => { // test helper: the "Show plane" reference surface — asserts no grid, bbox-sized surface, light-blue colour. `extent` is the projected u/v footprint the surface was actually sized to (work-area/tilted-plane aware), null for the fallback square. Surface w == extent.uSpan + 2*extent.margin.
|
|
5880
5943
|
if (!wpGroup) return { group: false, extent: wpExtent };
|
|
5881
5944
|
return { group: true, extent: wpExtent, children: wpGroup.children.map((c) => ({ type: c.type, color: c.material && '#' + c.material.color.getHexString(), opacity: c.material && c.material.opacity, w: c.geometry && c.geometry.parameters ? c.geometry.parameters.width : null, h: c.geometry && c.geometry.parameters ? c.geometry.parameters.height : null })) };
|
|
5882
5945
|
},
|
|
5883
|
-
toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds,
|
|
5946
|
+
toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], selectionHiddenIds: () => [...selectionHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds, visibleObjectIds, visibleGridIds,
|
|
5884
5947
|
setClipMode, clipMode: clipModeOn, addClipBox, toggleClip, removeClip, clearClips, getClips, renameClip, selectClip, setSelectedClips, selectedClips, deleteSelectedClips, clipState, setClipState,
|
|
5885
|
-
isolateSelected, clearIsolation, isIsolated,
|
|
5948
|
+
isolateSelected, hideSelected, clearIsolation, isIsolated, hasVisibilityFilter,
|
|
5886
5949
|
cameraState, setCameraState, sectionViewState, sceneBounds, objectsPaneState, applyObjectsPaneState, // saved-view snapshot surface (Views Organizer + F11 generated cuts)
|
|
5887
5950
|
workAreaSetAll, workAreaFromSelection, workAreaToggle, workAreaSetWhole, clearWorkArea, workAreaState,
|
|
5888
5951
|
armWorkPlanePick, setWorkPlanePrincipal, clearWorkPlane, toggleWorkPlaneVisible, workPlaneInfo,
|