@floless/app 0.127.5 → 0.128.0
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 +10189 -13091
- package/dist/schemas/drawing.vector.v1.schema.json +1 -1
- package/dist/schemas/steel.model.v2.schema.json +50 -127
- package/dist/skills/floless-app-steel-model/SKILL.md +5 -6
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +172 -1704
- package/dist/skills/floless-app-tweak-contract/SKILL.md +64 -174
- package/dist/skills/reading-structural-drawings/SKILL.md +2 -2
- package/dist/skills/steel-drawing-abbreviations/SKILL.md +2 -2
- package/dist/templates/steel-model.flo +45 -24
- package/dist/web/app.css +18 -92
- package/dist/web/aware.js +7 -1
- package/dist/web/grid-core.js +47 -0
- package/dist/web/index.html +0 -27
- package/dist/web/renderers.js +3 -14
- package/dist/web/steel-3d-view.js +87 -35
- package/dist/web/steel-editor.html +82 -58
- package/dist/web/steel-filter-core.js +7 -26
- package/dist/web/steel-filter.html +7 -7
- package/dist/web/steel-model-adapter.js +19 -250
- package/dist/web/steel-model-v2-commands.js +1 -0
- package/dist/web/workspaces.js +46 -838
- package/package.json +1 -1
- package/dist/schemas/steel.takeoff.v1.schema.json +0 -562
- package/dist/schemas/steel.takeoff.v1.staging-snapshot.json +0 -263
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
|
package/dist/web/index.html
CHANGED
|
@@ -214,7 +214,6 @@
|
|
|
214
214
|
deliberately not a card like #ws-revision-card above: that one is Drawings-scoped and
|
|
215
215
|
revision-shaped, and borrowing its weight for a one-time act would both misstate the
|
|
216
216
|
frequency and compete with an actual pending read on the same project. Model-step only. -->
|
|
217
|
-
<div class="ws-exports-gate ws-migrate-gate" id="ws-migrate-gate" hidden></div>
|
|
218
217
|
<!-- Two lazily-srced iframes so switching steps never reloads the editor's 3D state.
|
|
219
218
|
Same-origin like #contract-editor-frame (they call /api/contract directly). -->
|
|
220
219
|
<iframe id="ws-frame-model" class="ws-frame" title="Project model editor" hidden></iframe>
|
|
@@ -651,32 +650,6 @@
|
|
|
651
650
|
</div>
|
|
652
651
|
</div>
|
|
653
652
|
|
|
654
|
-
<!-- Convert to the model (steel.takeoff/v1 → steel.model/v2, unit 5, P7e).
|
|
655
|
-
A SEPARATE element from #revreview-modal rather than a reuse of it: the two have different
|
|
656
|
-
titles, different sub-copy and materially different Confirm semantics — that one applies a
|
|
657
|
-
SELECTION and is legitimately clickable with nothing ticked, this one is all-or-nothing. Sharing
|
|
658
|
-
the element would mean one Confirm handler with two meanings. It carries `revreview` so it
|
|
659
|
-
inherits the whole .rev-* vocabulary (width, scroll, rows, themed checkboxes) for free, and
|
|
660
|
-
`migreview` carries only the genuine deltas. -->
|
|
661
|
-
<div class="modal-backdrop" id="migrate-modal" role="dialog" aria-modal="true" aria-labelledby="migrate-title">
|
|
662
|
-
<div class="modal revreview migreview">
|
|
663
|
-
<div class="modal-title" id="migrate-title">Convert to the 3D model</div>
|
|
664
|
-
<div class="modal-sub" id="migrate-sub"></div>
|
|
665
|
-
<div class="rev-changed" id="migrate-changed" role="status" aria-live="polite" hidden></div>
|
|
666
|
-
<div class="rev-counts" id="migrate-counts"></div>
|
|
667
|
-
<div class="revreview-body" id="migrate-body"></div>
|
|
668
|
-
<!-- The tick progress, separate from the counts line above it: that one says what you GET, this
|
|
669
|
-
one says what is left to do. Live region so the count reaches a screen reader as it moves. -->
|
|
670
|
-
<div class="rev-counts mig-progress" id="migrate-progress" role="status" aria-live="polite" hidden></div>
|
|
671
|
-
<div class="modal-actions">
|
|
672
|
-
<button id="migrate-cancel">Cancel</button>
|
|
673
|
-
<!-- Hidden outright when the conversion is refused, never shown disabled: a blocked migration
|
|
674
|
-
is not something you can tick past, so an inert primary button would be an invitation. -->
|
|
675
|
-
<button id="migrate-confirm" class="primary">Convert</button>
|
|
676
|
-
</div>
|
|
677
|
-
</div>
|
|
678
|
-
</div>
|
|
679
|
-
|
|
680
653
|
<!-- Save-on-switch confirmation — shown when switching workflows with unsaved
|
|
681
654
|
input changes. Reuses the shared modal styling; no new backdrop look. -->
|
|
682
655
|
<div class="modal-backdrop" id="confirm-modal" role="dialog" aria-modal="true"
|
package/dist/web/renderers.js
CHANGED
|
@@ -13,17 +13,8 @@
|
|
|
13
13
|
// node-card View 3D / Export IFC / Export BOM / Send to Tekla chain; other contract types would
|
|
14
14
|
// 4xx or produce nonsense on those endpoints, so the shell hides the whole group.
|
|
15
15
|
window.CONTRACT_RENDERERS = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
scene: true,
|
|
19
|
-
},
|
|
20
|
-
// The SAME editor page, deliberately — a migrated project is the same project, and sending its owner
|
|
21
|
-
// to a different URL would say otherwise. What the editor then offers is narrower (P7d opens v2 for
|
|
22
|
-
// viewing plus the model-grid edit); that is the editor's business, not the registry's.
|
|
23
|
-
//
|
|
24
|
-
// `scene: true` because the whole export chain reads v2: `contractToScene`, `contractToAwareScene` and
|
|
25
|
-
// `contractToBom` all have v2 arms, and P7b wired the routes behind View 3D / Export IFC / Export BOM /
|
|
26
|
-
// Send to Tekla to accept an activated store's v2. Marking it false would hide a group that works.
|
|
16
|
+
// Steel Model has one native editor and one native contract type. `scene: true` exposes its viewer
|
|
17
|
+
// and export chain.
|
|
27
18
|
'steel.model/v2': {
|
|
28
19
|
editorUrl: (appId) => '/steel-editor.html?app=' + encodeURIComponent(appId),
|
|
29
20
|
scene: true,
|
|
@@ -40,7 +31,5 @@ window.CONTRACT_RENDERERS = {
|
|
|
40
31
|
// A node "emits" a contract type when its config carries a `contract` field,
|
|
41
32
|
// or when its agent is the known steel-takeoff agent.
|
|
42
33
|
window.contractTypeOf = function contractTypeOf(node) {
|
|
43
|
-
return (node && node.config && node.config.contract) ||
|
|
44
|
-
// TODO: drop this agent-name fallback once every steel-takeoff node carries config.contract.
|
|
45
|
-
(node && node.agent === 'steel-takeoff-us' ? 'steel.takeoff/v1' : null);
|
|
34
|
+
return (node && node.config && node.config.contract) || null;
|
|
46
35
|
};
|
|
@@ -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)
|
|
@@ -73,6 +74,8 @@ let soloGroups = new Set(); // profile keys isolated via the leg
|
|
|
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
|
|
75
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)
|
|
76
79
|
let cube = null; // ViewCube { renderer, scene, cam, mesh, faces }
|
|
77
80
|
let triad = null; // world-axis triad { renderer, scene, cam, group } — passive X/Y/Z readout
|
|
78
81
|
const DRAG_TOL_PX = 4; // movement past this = a drag (not a click)
|
|
@@ -885,14 +888,17 @@ function buildFromScene(sc) {
|
|
|
885
888
|
dimParts = (sc.elements || []).filter((el) => el && (el.kind === 'plate' || el.kind === 'cut'));
|
|
886
889
|
renderClipGizmo(); // re-anchor the selected clip's gizmo to the (possibly new) sceneBox after a rebuild
|
|
887
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
|
|
888
898
|
buildStructGrid();
|
|
889
899
|
buildRefLines();
|
|
890
900
|
syncMemberLabels(); // refresh the member-label pool from the (possibly edited) member set
|
|
891
901
|
syncPropLabels(); // re-anchor the property labels too (member geometry may have moved)
|
|
892
|
-
const hadVisibilityFilter = hasVisibilityFilter();
|
|
893
|
-
if (isolatedIds) { isolatedIds = new Set([...isolatedIds].filter((id) => meshById.has(id))); if (!isolatedIds.size) isolatedIds = null; } // drop ids an edit removed; if none survive, exit isolation
|
|
894
|
-
if (connHidden.size) connHidden = new Set([...connHidden].filter((id) => meshById.has(id))); // drop per-part hides whose mesh an edit removed
|
|
895
|
-
if (selectionHidden.size) selectionHidden = new Set([...selectionHidden].filter((id) => meshById.has(id))); // drop transient hides whose mesh an edit removed
|
|
896
902
|
if (hadVisibilityFilter !== hasVisibilityFilter()) notifyVisibilityChange(); // keep the host's recovery control honest when an edit removes the last hidden/isolated mesh
|
|
897
903
|
applyGroupVisibility(); applyDisplayMode();
|
|
898
904
|
built = true;
|
|
@@ -2042,6 +2048,7 @@ let structGridGroup = null, gridLabelGroup = null;
|
|
|
2042
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
|
|
2043
2049
|
const structGridLines = new Map();
|
|
2044
2050
|
let selectedGridIds = new Set();
|
|
2051
|
+
let structGridSignature = null;
|
|
2045
2052
|
const gridTexCache = new Map(); // 'b:LABEL' bubble / 't:LABEL' tag -> CanvasTexture (kept until dispose)
|
|
2046
2053
|
|
|
2047
2054
|
// Snap targets for the 3D tools. Members come from the WHOLE model — every sheet, not just the active
|
|
@@ -2114,23 +2121,24 @@ function clearStructGrid() {
|
|
|
2114
2121
|
structGridGroup = gridLabelGroup = null;structGridLines.clear();gridLevelsMm = [];
|
|
2115
2122
|
}
|
|
2116
2123
|
function buildStructGrid() {
|
|
2117
|
-
clearStructGrid();
|
|
2118
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.
|
|
2119
|
-
if (!api || !scene) return;
|
|
2120
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
|
|
2121
2126
|
// active sheet's DISPLAY space — px, with Y growing DOWN the page — so the two conversions below are a
|
|
2122
2127
|
// scale AND a reflection. v2's grid is already world mm with Y up. Handing a world-mm grid to the v1
|
|
2123
2128
|
// conversion would not throw; it would draw the whole grid mirrored about Y, plausibly, at 1/12 scale.
|
|
2124
2129
|
// So the read half answers with the drawable geometry AND the two facts needed to place it.
|
|
2125
2130
|
let d = null;
|
|
2126
|
-
try { d = MODEL().gridDraw(); }
|
|
2127
|
-
catch (e) { console.warn('[steel-3d] grid skipped (bad grid data)', e);
|
|
2128
|
-
|
|
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
|
|
2129
2137
|
const { g, geo, k, flipY } = d;
|
|
2130
|
-
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;}
|
|
2131
2139
|
const mmX = (u) => u * k, mmY = (u) => (flipY ? -u : u) * k; // stored space → scene
|
|
2132
2140
|
const levels = geo.zs.length ? visibleGridLevels(geo.zs, g.hidden_z) : [{ mm: 0, label: '0' }];
|
|
2133
|
-
if (!levels.length) return;
|
|
2141
|
+
if (!levels.length) {finish();return;} // every authored Z datum is hidden
|
|
2134
2142
|
gridLevelsMm = levels.map((lv) => lv.mm); // the planes grid snapping evaluates on — same list, same order as what gets drawn below
|
|
2135
2143
|
structGridGroup = new THREE.Group();
|
|
2136
2144
|
// Drawn at the level's TRUE Z. It used to sit 25 mm under it ("no z-fight/burial"), but the snap
|
|
@@ -2160,6 +2168,7 @@ function buildStructGrid() {
|
|
|
2160
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);});
|
|
2161
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
|
|
2162
2170
|
overlayScene.add(gridLabelGroup);
|
|
2171
|
+
finish();
|
|
2163
2172
|
}
|
|
2164
2173
|
|
|
2165
2174
|
// The ortho frustum half-height in world units (set by a fit to the box, or by a projection toggle
|
|
@@ -2453,7 +2462,13 @@ function visibleMemberIds() {
|
|
|
2453
2462
|
for (const [id, m] of meshById) if (m.visible && !m.userData.derived) out.push(id);
|
|
2454
2463
|
return out;
|
|
2455
2464
|
}
|
|
2456
|
-
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); }
|
|
2457
2472
|
function toggleGroup(k) { if (groupHidden.has(k)) groupHidden.delete(k); else groupHidden.add(k); soloGroups.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2458
2473
|
// Hide/show a SET of groups in one pass (a legend type-category master toggle) — deterministic (not a flip),
|
|
2459
2474
|
// so "hide all" / "show all" for the category is exact. Clears solo, like toggleGroup.
|
|
@@ -2464,7 +2479,7 @@ function setIdsHidden(ids, hidden) { for (const id of (ids || [])) { if (hidden)
|
|
|
2464
2479
|
// Isolate an explicit SET of profile groups (the editor's legend builds it from Ctrl/Shift dbl-clicks, Explorer-style).
|
|
2465
2480
|
function setSoloGroups(keys) { soloGroups = new Set((keys || []).filter((k) => k != null)); if (soloGroups.size) groupHidden.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); notifyVisibilityChange(); }
|
|
2466
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)
|
|
2467
|
-
function showAllGroups() { groupHidden.clear(); soloGroups.clear(); isolatedIds = null; connHidden.clear(); selectionHidden.clear(); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); }
|
|
2482
|
+
function showAllGroups() { groupHidden.clear(); soloGroups.clear(); isolatedIds = null; isolatedGridIds = null; connHidden.clear(); selectionHidden.clear(); gridSelectionHidden.clear(); applyGroupVisibility(); applyGridVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); }
|
|
2468
2483
|
function groupState() { return { hidden: [...groupHidden], solo: [...soloGroups] }; }
|
|
2469
2484
|
// One serialisable snapshot of the objects-list pane's PERSISTENT visibility state — group hide/solo +
|
|
2470
2485
|
// isolate-selected + per-part legend hides. This is what a saved view (Views Organizer) captures; it
|
|
@@ -2481,18 +2496,19 @@ function applyObjectsPaneState(s) {
|
|
|
2481
2496
|
isolatedIds = (Array.isArray(s.isolated) && s.isolated.length) ? new Set(s.isolated) : null;
|
|
2482
2497
|
connHidden = new Set(Array.isArray(s.connHidden) ? s.connHidden : []);
|
|
2483
2498
|
selectionHidden.clear(); // Hide selected is session-only; applying a saved view restores its authored persistent visibility without leaking the current session filter
|
|
2484
|
-
|
|
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();
|
|
2485
2501
|
notifyVisibilityChange();
|
|
2486
2502
|
}
|
|
2487
2503
|
// Tekla "isolate selected": show ONLY the currently-selected parts (a snapshot taken now — distinct from
|
|
2488
2504
|
// soloToggle, which isolates a whole PROFILE group from the legend). clearIsolation / showAllGroups restore all.
|
|
2489
|
-
function isolateSelected() { if (!selIds.size) return false; isolatedIds = new Set(selIds); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); return true; }
|
|
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; }
|
|
2490
2506
|
// Hide the current selection by explicit mesh id. This remains session-only because v2 saved views require tagged
|
|
2491
2507
|
// SceneRefs while the renderer owns raw ids; broadening that contract is a separate migration, not toolbar state.
|
|
2492
|
-
function hideSelected() { const ids = [...selIds].filter((id) => meshById.has(id)); if (!ids.length) return 0; for (const id of ids) selectionHidden.add(id); applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); return ids.length; }
|
|
2493
|
-
function clearIsolation() { if (isolatedIds === null) return; isolatedIds = null; applyGroupVisibility(); rebuildEndpoints(); refreshOverlayDims(); refreshDims(); updateStatusChip(); notifyVisibilityChange(); }
|
|
2494
|
-
function isIsolated() { return isolatedIds !== null; }
|
|
2495
|
-
function hasVisibilityFilter() { return isolatedIds !== null || groupHidden.size > 0 || soloGroups.size > 0 || connHidden.size > 0 || selectionHidden.size > 0; }
|
|
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; }
|
|
2496
2512
|
function getGroups() { return sceneGroups.map((g) => ({ ...g })); }
|
|
2497
2513
|
|
|
2498
2514
|
// ---- clip planes / clip boxes (Tekla-style sectioning) ----
|
|
@@ -3006,7 +3022,7 @@ function onKey(e) {
|
|
|
3006
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
|
|
3007
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
|
|
3008
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
|
|
3009
|
-
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)
|
|
3010
3026
|
// Esc ascends the REFERENCE drill: one object → the whole reference. ONE RUNG ONLY — unlike the
|
|
3011
3027
|
// connection ladder below, which is part → whole → nothing. A reference is borrowed geometry you keep
|
|
3012
3028
|
// selected while you build against it, so Esc stops at the reference rather than clearing it; the
|
|
@@ -3811,7 +3827,22 @@ function pickGridAt(cx,cy){
|
|
|
3811
3827
|
return best;
|
|
3812
3828
|
}
|
|
3813
3829
|
|
|
3814
|
-
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();}
|
|
3815
3846
|
// Raycast ALL visible meshes — members AND derived connection parts — at a client point → ids
|
|
3816
3847
|
// front-to-back (nearest first), deduped. Backs click-to-cycle so a small plate/bolt/weld stacked on a
|
|
3817
3848
|
// beam at a joint is reachable without a modifier (D). pickAt stays members-only — the down-gesture
|
|
@@ -3831,6 +3862,7 @@ const CYCLE_TOL_PX = 8;
|
|
|
3831
3862
|
function resetCycle() { cycleAnchor = null; cycleIds = []; cycleIdx = 0; }
|
|
3832
3863
|
function clickSelect(cx, cy, ctrl) {
|
|
3833
3864
|
let hits = []; try { hits = pickAllAt(cx, cy); } catch { hits = []; }
|
|
3865
|
+
selectionTrace={phase:'up-pick',x:cx,y:cy,ownHits:hits.slice(0,4)};
|
|
3834
3866
|
if (hits.length) selectReference(null); // anything of OURS under the cursor drops a reference selection
|
|
3835
3867
|
if (!hits.length) {
|
|
3836
3868
|
// Nothing of ours here — only NOW may a reference answer. Consulted second, never first, so a
|
|
@@ -3841,7 +3873,12 @@ function clickSelect(cx, cy, ctrl) {
|
|
|
3841
3873
|
// stacked inside a connection, and it is free here: the modifier's other meaning (additive select)
|
|
3842
3874
|
// belongs to the branch above, which this arm is only ever reached instead of.
|
|
3843
3875
|
let ref = null; try { ref = pickReferenceAt(cx, cy); } catch { ref = null; }
|
|
3876
|
+
selectionTrace={...selectionTrace,reference:ref,referenceAllowed:!api||!api.canSelectReference||api.canSelectReference()};
|
|
3844
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;
|
|
3845
3882
|
resetCycle();
|
|
3846
3883
|
// The drill FALLS BACK to selecting the whole reference when the object cannot be addressed
|
|
3847
3884
|
// (`objectIndex` -1 from a mesh built before this existed). Refusing outright would make Ctrl+click
|
|
@@ -4028,7 +4065,7 @@ const memberById = (id) => { const all = (api && api.allMembers && api.allMember
|
|
|
4028
4065
|
* ADAPTER boundary, not scattered `if (v2)` branches through the editor closure" — a branch per geometry
|
|
4029
4066
|
* site is the shape this epic has rejected three times.
|
|
4030
4067
|
*
|
|
4031
|
-
* The host supplies
|
|
4068
|
+
* The host supplies the native steel.model/v2 computation — the per-plan
|
|
4032
4069
|
* scale index, `planScaleOf`, `memberGeometryInOwnPlan` — so v1 stays byte-identical by construction
|
|
4033
4070
|
* rather than by test. steel.model/v2's answers from world-mm members and needs none of it.
|
|
4034
4071
|
*
|
|
@@ -4441,6 +4478,7 @@ const tfLock = new Set(); // subset of {'u','v','n'} the move is LINE-loc
|
|
|
4441
4478
|
let tfCandidates = null;
|
|
4442
4479
|
let tfGhost = null, tfRubber = null, tfRubberA = null, tfGhostMat = null;
|
|
4443
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));
|
|
4444
4482
|
const cmHasBase = () => !!tfDraft;
|
|
4445
4483
|
const cmLastClient = () => tfLastClient;
|
|
4446
4484
|
// X/Y/Z each TOGGLE their axis in the lock set (press again to release, press another to ADD → the move
|
|
@@ -4567,7 +4605,11 @@ function tfGhostBuild(offs) {
|
|
|
4567
4605
|
tfDisposeGhost(); // dispose the previous rebuild's own geometries (the >600 boxes) before dropping it
|
|
4568
4606
|
tfGhost = new THREE.Group();
|
|
4569
4607
|
if (!tfGhostMat) { tfGhostMat = new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.3, depthWrite: false }); }
|
|
4570
|
-
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
|
+
}
|
|
4571
4613
|
if (sel.length * offs.length <= 600) {
|
|
4572
4614
|
for (const off of offs) for (const m of sel) {
|
|
4573
4615
|
const c = new THREE.Mesh(m.geometry, tfGhostMat); // shares the source geometry — nothing to dispose
|
|
@@ -4607,7 +4649,7 @@ function tfPreview(e) {
|
|
|
4607
4649
|
}
|
|
4608
4650
|
function tfClick(e) {
|
|
4609
4651
|
const st = cmActive(); if (!st) return false;
|
|
4610
|
-
if (!
|
|
4652
|
+
if (!cmTargetPresent(st)) { // selection drained while armed (undo/delete) — end the tool and let the click SELECT instead
|
|
4611
4653
|
if (api && api.toast) api.toast('Selection is empty — ' + (st.tool === 'move' ? 'Move' : 'Copy') + ' ended');
|
|
4612
4654
|
if (api && api.disarmTransform) api.disarmTransform();
|
|
4613
4655
|
return false;
|
|
@@ -4959,6 +5001,10 @@ function onDown(e) {
|
|
|
4959
5001
|
}
|
|
4960
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.
|
|
4961
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;}}
|
|
4962
5008
|
if (!id) { pending = null; boxSel = { x: e.clientX, y: e.clientY }; return; } // empty space → box-select on drag
|
|
4963
5009
|
e.stopPropagation(); controls.enabled = false; // grabbed a member → suppress orbit (enabled=false is the reliable guard)
|
|
4964
5010
|
try {
|
|
@@ -5209,7 +5255,7 @@ function onMove(e) {
|
|
|
5209
5255
|
if (pending && pending.clipDrag) { onMoveClip(e); return; } // dragging a clip handle (plane offset / box face)
|
|
5210
5256
|
if (pending && pending.frameDrag) { onMoveFrame(e); return; } // dragging the local-frame origin / rotation ring
|
|
5211
5257
|
if (!pending || pending.geo) return;
|
|
5212
|
-
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
|
|
5213
5259
|
if (pending.epDrag) { onMoveEndpoint(e); return; }
|
|
5214
5260
|
if (!pending.grab || !pending.origMm) return;
|
|
5215
5261
|
if (!dragging && Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) <= DRAG_TOL_PX) return;
|
|
@@ -5317,7 +5363,7 @@ const gridPlaneSpecs=planes=>(planes||[]).map(p=>({normal:[p.normal.x,p.normal.y
|
|
|
5317
5363
|
function visibleGridSegment(a,b){return clipSegmentToPlanes(a,b,gridPlaneSpecs(renderer&&renderer.clippingPlanes));}
|
|
5318
5364
|
function gridCameraFrustum(){camera.updateMatrixWorld();return new THREE.Frustum().setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse));}
|
|
5319
5365
|
function cameraVisibleGridSegment(p,frustum){return clipSegmentToPlanes(p[0],p[1],gridPlaneSpecs(frustum&&frustum.planes));}
|
|
5320
|
-
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.
|
|
5321
5367
|
// Connection Components whose screen footprint (projected bbox) meets a marquee rect — so area-select picks
|
|
5322
5368
|
// up connections, not just members. window: the whole footprint enclosed · crossing: it overlaps the rect.
|
|
5323
5369
|
function connsInRect(x0, y0, x1, y1, windowMode) {
|
|
@@ -5392,7 +5438,7 @@ function onUp(e) {
|
|
|
5392
5438
|
controls.enabled = true;
|
|
5393
5439
|
const moved = downXY ? Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) : Infinity; downXY = null;
|
|
5394
5440
|
if (!p) return;
|
|
5395
|
-
if(p.filteredGrid)return;
|
|
5441
|
+
if(p.filteredGrid||p.filteredReference)return;
|
|
5396
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;}
|
|
5397
5443
|
if (p.clipDrag) return; // a clip handle drag is applied live during onMoveClip; nothing to commit on up (controls re-enabled above)
|
|
5398
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)
|
|
@@ -5596,7 +5642,7 @@ function updateStatusChip() {
|
|
|
5596
5642
|
if (!hoverChip || !canvasEl) return;
|
|
5597
5643
|
const rect = canvasEl.getBoundingClientRect();
|
|
5598
5644
|
let txt = '';
|
|
5599
|
-
const showId
|
|
5645
|
+
const selectionStatus=objectSelectionStatus(selIds.size,selectedGridIds.size),showId=hoverId||(!selectionStatus&&selIds.size===1?[...selIds][0]:null);
|
|
5600
5646
|
// The badge follows the cursor and so clips away at the window edge — from there this chip is the
|
|
5601
5647
|
// only thing still telling the user what releasing will do.
|
|
5602
5648
|
if (teklaDrag && teklaDrag.active) {
|
|
@@ -5624,9 +5670,9 @@ function updateStatusChip() {
|
|
|
5624
5670
|
else if (clipMode === 'plane') txt = 'Click a face to set a clip plane · Esc to cancel';
|
|
5625
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';
|
|
5626
5672
|
else if (showId) { const m = memberById(showId); txt = m ? `${m.id} · ${m.profile || '—'}` : ''; }
|
|
5627
|
-
else if (
|
|
5628
|
-
else if (
|
|
5629
|
-
else if (selectionHidden.size) txt = `${selectionHidden.size} objects hidden · Show all to restore`;
|
|
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`;
|
|
5630
5676
|
// A read-only host (the vector 3D viewer) supplies its own idle hint — the default speaks editing
|
|
5631
5677
|
// verbs (move/stretch/elevate) a viewer's no-op api would silently ignore. Otherwise the default
|
|
5632
5678
|
// tells the truth about the drag-move/copy toggle (ON = drag-move + Ctrl-drag-copy; OFF = click-select).
|
|
@@ -5752,7 +5798,8 @@ function debug() {
|
|
|
5752
5798
|
// the pixels valid. Exists so a MATERIAL change can be checked by looking at it, not only by
|
|
5753
5799
|
// asserting on state — the whole point of Realistic is how it looks.
|
|
5754
5800
|
snapshot: (quality = 0.82) => { renderer.render(scene, camera); return canvasEl.toDataURL('image/jpeg', quality); },
|
|
5755
|
-
hidden: [...groupHidden], solo: [...soloGroups], isolated: isolatedIds ? [...isolatedIds] : null, selectionHidden: [...selectionHidden], 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),
|
|
5756
5803
|
endpoints: epGroup ? epGroup.children.length : 0,
|
|
5757
5804
|
endpointColors: epGroup ? epGroup.children.map((c) => '#' + c.material.color.getHexString()) : [],
|
|
5758
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
|
|
@@ -5766,6 +5813,7 @@ function debug() {
|
|
|
5766
5813
|
clips: getClips(), clipPlaneCount: renderer && renderer.clippingPlanes ? renderer.clippingPlanes.length : 0, clipMode, workArea: workAreaState(), selectedClips: [...selectedClipIds],
|
|
5767
5814
|
workPlane: workPlaneInfo(), tfHasBase: !!tfDraft, tfGhosts: tfGhost ? tfGhost.children.length : 0, drHasStart: !!drDraft,
|
|
5768
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],
|
|
5769
5817
|
};
|
|
5770
5818
|
}
|
|
5771
5819
|
// test helper: the current material colour + emissive of a member (verifies deselect restores colour)
|
|
@@ -5834,6 +5882,9 @@ function referenceObjectsScreen(refId, opts) {
|
|
|
5834
5882
|
}
|
|
5835
5883
|
return out;
|
|
5836
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};}
|
|
5837
5888
|
// test helper: projected, clip-trimmed structural-grid segments. E2E uses these coordinates to drive a
|
|
5838
5889
|
// real line click / marquee without guessing where an oblique 3D line landed after camera fitting.
|
|
5839
5890
|
function gridSegmentsScreen() {
|
|
@@ -5869,6 +5920,7 @@ window.Steel3DView = {
|
|
|
5869
5920
|
refMeasureLabelText: () => (refMeasureLabel && refMeasureLabel.style.display !== 'none' ? refMeasureLabel.textContent : null),
|
|
5870
5921
|
refMeasureLineOn: () => !!(refMeasureLine && refMeasureLine.visible),
|
|
5871
5922
|
refMeasurePointAtScreen: (x, y) => refMeasurePointAt({ clientX: x, clientY: y }), // test probe: what WOULD snap at a cursor — read-only, no pick
|
|
5923
|
+
selectionHitAtScreen,
|
|
5872
5924
|
refCandidateCount: (id) => referenceCandidates(id).length, // test probe: how many points the restricted set offers
|
|
5873
5925
|
// TEST PROBE FOR THE RESTRICTION ITSELF, and it exists because nothing else can see it: swap
|
|
5874
5926
|
// referenceCandidates(refId) for allCandidates(null) and every other assertion in this feature still
|
|
@@ -5886,12 +5938,12 @@ window.Steel3DView = {
|
|
|
5886
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
|
|
5887
5939
|
refreshGrid: buildStructGrid, // grid edited in the panel → re-render without a full rebuild
|
|
5888
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)
|
|
5889
|
-
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
|
|
5890
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.
|
|
5891
5943
|
if (!wpGroup) return { group: false, extent: wpExtent };
|
|
5892
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 })) };
|
|
5893
5945
|
},
|
|
5894
|
-
toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], selectionHiddenIds: () => [...selectionHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds,
|
|
5946
|
+
toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], selectionHiddenIds: () => [...selectionHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds, visibleObjectIds, visibleGridIds,
|
|
5895
5947
|
setClipMode, clipMode: clipModeOn, addClipBox, toggleClip, removeClip, clearClips, getClips, renameClip, selectClip, setSelectedClips, selectedClips, deleteSelectedClips, clipState, setClipState,
|
|
5896
5948
|
isolateSelected, hideSelected, clearIsolation, isIsolated, hasVisibilityFilter,
|
|
5897
5949
|
cameraState, setCameraState, sectionViewState, sceneBounds, objectsPaneState, applyObjectsPaneState, // saved-view snapshot surface (Views Organizer + F11 generated cuts)
|