@floless/app 0.93.0 → 0.94.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 +92 -37
- package/dist/web/app.css +14 -0
- package/dist/web/steel-3d-core.js +16 -15
- package/dist/web/steel-3d-view.js +164 -102
- package/dist/web/steel-editor.html +123 -9
- package/dist/web/workspaces.js +86 -5
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.
|
|
53109
|
+
define: true ? "0.94.0" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.94.0" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -54466,6 +54466,40 @@ function deleteArchivedProject(id) {
|
|
|
54466
54466
|
// knowledge-routes.ts
|
|
54467
54467
|
var import_node_fs22 = require("node:fs");
|
|
54468
54468
|
|
|
54469
|
+
// sse.ts
|
|
54470
|
+
var clients = /* @__PURE__ */ new Set();
|
|
54471
|
+
var HEARTBEAT_MS = 2e4;
|
|
54472
|
+
function addClient(reply) {
|
|
54473
|
+
clients.add(reply);
|
|
54474
|
+
const ping2 = setInterval(() => {
|
|
54475
|
+
try {
|
|
54476
|
+
reply.raw.write(":ping\n\n");
|
|
54477
|
+
} catch {
|
|
54478
|
+
clearInterval(ping2);
|
|
54479
|
+
clients.delete(reply);
|
|
54480
|
+
}
|
|
54481
|
+
}, HEARTBEAT_MS);
|
|
54482
|
+
reply.raw.on("close", () => {
|
|
54483
|
+
clearInterval(ping2);
|
|
54484
|
+
clients.delete(reply);
|
|
54485
|
+
});
|
|
54486
|
+
}
|
|
54487
|
+
function broadcast(event) {
|
|
54488
|
+
const frame = `data: ${JSON.stringify(event)}
|
|
54489
|
+
|
|
54490
|
+
`;
|
|
54491
|
+
for (const reply of clients) {
|
|
54492
|
+
try {
|
|
54493
|
+
reply.raw.write(frame);
|
|
54494
|
+
} catch {
|
|
54495
|
+
clients.delete(reply);
|
|
54496
|
+
}
|
|
54497
|
+
}
|
|
54498
|
+
}
|
|
54499
|
+
function clientCount() {
|
|
54500
|
+
return clients.size;
|
|
54501
|
+
}
|
|
54502
|
+
|
|
54469
54503
|
// knowledge-store.ts
|
|
54470
54504
|
var import_node_crypto7 = require("node:crypto");
|
|
54471
54505
|
var import_node_fs21 = require("node:fs");
|
|
@@ -55204,6 +55238,36 @@ function knowledgeErrorStatus(e) {
|
|
|
55204
55238
|
if (e.code === "io-error") return 500;
|
|
55205
55239
|
return 400;
|
|
55206
55240
|
}
|
|
55241
|
+
var QUEUED_ORGANIZE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
55242
|
+
function organizeInFlight(projectId, now = Date.now()) {
|
|
55243
|
+
if (readOrganize(projectId) !== null) return true;
|
|
55244
|
+
const lock = readLock(projectId);
|
|
55245
|
+
return lock !== null && now - lock.createdAt < LOCK_STALE_MS;
|
|
55246
|
+
}
|
|
55247
|
+
function expiredOrganizeRequestIds(requests, isInFlight, now, ttlMs = QUEUED_ORGANIZE_TTL_MS) {
|
|
55248
|
+
const out = [];
|
|
55249
|
+
for (const r of requests) {
|
|
55250
|
+
if (r.type !== "knowledge-organize" || !r.project) continue;
|
|
55251
|
+
const age = now - Date.parse(r.createdAt);
|
|
55252
|
+
if (!Number.isFinite(age) || age <= ttlMs) continue;
|
|
55253
|
+
if (isInFlight(r.project)) continue;
|
|
55254
|
+
out.push(r.id);
|
|
55255
|
+
}
|
|
55256
|
+
return out;
|
|
55257
|
+
}
|
|
55258
|
+
function sweepExpiredOrganizeRequests(now = Date.now()) {
|
|
55259
|
+
const ids = expiredOrganizeRequestIds(listRequests(), (p) => organizeInFlight(p, now), now);
|
|
55260
|
+
let swept = 0;
|
|
55261
|
+
for (const id of ids) {
|
|
55262
|
+
try {
|
|
55263
|
+
if (deleteRequest(id)) swept++;
|
|
55264
|
+
} catch (e) {
|
|
55265
|
+
console.warn(`sweepExpiredOrganizeRequests: could not delete ${id}: ${e instanceof Error ? e.message : e}`);
|
|
55266
|
+
}
|
|
55267
|
+
}
|
|
55268
|
+
if (swept > 0) broadcast({ type: "requests-changed" });
|
|
55269
|
+
return swept;
|
|
55270
|
+
}
|
|
55207
55271
|
function registerKnowledgeRoutes(app) {
|
|
55208
55272
|
app.post(
|
|
55209
55273
|
"/api/projects/:id/knowledge/sources",
|
|
@@ -55428,6 +55492,28 @@ function registerKnowledgeRoutes(app) {
|
|
|
55428
55492
|
}
|
|
55429
55493
|
}
|
|
55430
55494
|
);
|
|
55495
|
+
app.delete(
|
|
55496
|
+
"/api/projects/:id/knowledge/requests/:requestId",
|
|
55497
|
+
async (req, reply) => {
|
|
55498
|
+
try {
|
|
55499
|
+
const project = getProject(req.params.id);
|
|
55500
|
+
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
55501
|
+
if (!resolveOrganizeRequest(project.id, req.params.requestId)) {
|
|
55502
|
+
return reply.status(404).send({ ok: false, error: "unknown organize request", code: "not-found" });
|
|
55503
|
+
}
|
|
55504
|
+
if (organizeInFlight(project.id)) {
|
|
55505
|
+
return reply.status(409).send({ ok: false, error: "organize already started \u2014 it can no longer be cancelled", code: "already-started" });
|
|
55506
|
+
}
|
|
55507
|
+
deleteRequest(req.params.requestId);
|
|
55508
|
+
broadcast({ type: "requests-changed" });
|
|
55509
|
+
return { ok: true };
|
|
55510
|
+
} catch (e) {
|
|
55511
|
+
if (e instanceof ProjectError) return reply.status(400).send({ ok: false, error: e.message });
|
|
55512
|
+
if (e instanceof KnowledgeError) return reply.status(knowledgeErrorStatus(e)).send({ ok: false, error: e.message });
|
|
55513
|
+
throw e;
|
|
55514
|
+
}
|
|
55515
|
+
}
|
|
55516
|
+
);
|
|
55431
55517
|
}
|
|
55432
55518
|
|
|
55433
55519
|
// project-versions-store.ts
|
|
@@ -62235,40 +62321,6 @@ var import_node_path29 = require("node:path");
|
|
|
62235
62321
|
var import_node_fs32 = require("node:fs");
|
|
62236
62322
|
var import_node_path28 = require("node:path");
|
|
62237
62323
|
|
|
62238
|
-
// sse.ts
|
|
62239
|
-
var clients = /* @__PURE__ */ new Set();
|
|
62240
|
-
var HEARTBEAT_MS = 2e4;
|
|
62241
|
-
function addClient(reply) {
|
|
62242
|
-
clients.add(reply);
|
|
62243
|
-
const ping2 = setInterval(() => {
|
|
62244
|
-
try {
|
|
62245
|
-
reply.raw.write(":ping\n\n");
|
|
62246
|
-
} catch {
|
|
62247
|
-
clearInterval(ping2);
|
|
62248
|
-
clients.delete(reply);
|
|
62249
|
-
}
|
|
62250
|
-
}, HEARTBEAT_MS);
|
|
62251
|
-
reply.raw.on("close", () => {
|
|
62252
|
-
clearInterval(ping2);
|
|
62253
|
-
clients.delete(reply);
|
|
62254
|
-
});
|
|
62255
|
-
}
|
|
62256
|
-
function broadcast(event) {
|
|
62257
|
-
const frame = `data: ${JSON.stringify(event)}
|
|
62258
|
-
|
|
62259
|
-
`;
|
|
62260
|
-
for (const reply of clients) {
|
|
62261
|
-
try {
|
|
62262
|
-
reply.raw.write(frame);
|
|
62263
|
-
} catch {
|
|
62264
|
-
clients.delete(reply);
|
|
62265
|
-
}
|
|
62266
|
-
}
|
|
62267
|
-
}
|
|
62268
|
-
function clientCount() {
|
|
62269
|
-
return clients.size;
|
|
62270
|
-
}
|
|
62271
|
-
|
|
62272
62324
|
// trigger-sessions.ts
|
|
62273
62325
|
var import_node_fs31 = require("node:fs");
|
|
62274
62326
|
var import_node_os16 = require("node:os");
|
|
@@ -67934,7 +67986,10 @@ async function startServer() {
|
|
|
67934
67986
|
broadcast({ type: "steel-favourites-changed" });
|
|
67935
67987
|
return { ok: true };
|
|
67936
67988
|
});
|
|
67937
|
-
app.get("/api/requests", async () =>
|
|
67989
|
+
app.get("/api/requests", async () => {
|
|
67990
|
+
sweepExpiredOrganizeRequests();
|
|
67991
|
+
return { ok: true, requests: listRequests() };
|
|
67992
|
+
});
|
|
67938
67993
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
67939
67994
|
const n = Number.parseInt(req.params.n, 10);
|
|
67940
67995
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
package/dist/web/app.css
CHANGED
|
@@ -3473,6 +3473,9 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
|
|
|
3473
3473
|
.ws-card .ws-kebab { background:transparent; border:1px solid transparent; color:var(--text-dim);
|
|
3474
3474
|
padding:2px 7px; border-radius:4px; font-size:14px; line-height:1; flex:none; }
|
|
3475
3475
|
.ws-card .ws-kebab:hover { border-color:var(--border-strong); color:var(--text); }
|
|
3476
|
+
/* Just-duplicated / just-renamed card gets one glow so the eye finds it before the background reload lands. */
|
|
3477
|
+
.ws-card.is-new { border-color:var(--accent-bright); animation:card-pulse 0.6s ease-in-out; }
|
|
3478
|
+
@media (prefers-reduced-motion: reduce) { .ws-card.is-new { animation:none; box-shadow:0 0 0 1px var(--accent); } }
|
|
3476
3479
|
/* Archived projects ("Trash") — a collapsed disclosure below the live grid. Demoted vs .ws-card:
|
|
3477
3480
|
flat rows in one contained panel, muted text — reads as "put away", not "open me". */
|
|
3478
3481
|
.ws-archived { margin-top:22px; border-top:1px solid var(--border); padding-top:10px; }
|
|
@@ -3879,6 +3882,17 @@ tr.hist-diff-row[hidden] { display:none; }
|
|
|
3879
3882
|
.kb-spin { width:11px; height:11px; border:2px solid var(--accent-dim); border-top-color:var(--accent-bright);
|
|
3880
3883
|
border-radius:50%; animation:spin .8s linear infinite; flex:none; }
|
|
3881
3884
|
@media (prefers-reduced-motion: reduce) { .kb-spin { animation:none; } }
|
|
3885
|
+
/* Cancel a QUEUED organize — a quiet link-style action flowing inline at the end of the "waiting to
|
|
3886
|
+
start…" line (the rail is too narrow to pin a separate control beside wrapping text). Cancel DELETES
|
|
3887
|
+
a queued request, so it follows the house "reversible destructive" idiom (#requests-clear / .ws-del):
|
|
3888
|
+
neutral at rest, var(--err) on hover — NOT the .kb-fname navigation hover. Overrides the global
|
|
3889
|
+
`select, button` grey-surface base to a bare text button; only existing tokens; data-tip, never title. */
|
|
3890
|
+
.kb-pending-cancel { font:inherit; font-size:10.5px; background:none; border:none; padding:0; margin-left:6px;
|
|
3891
|
+
color:var(--text-dim); cursor:pointer; text-decoration:underline; text-underline-offset:2px;
|
|
3892
|
+
text-decoration-color:transparent; transition:color .12s, text-decoration-color .12s; }
|
|
3893
|
+
.kb-pending-cancel:hover { color:var(--err); text-decoration-color:color-mix(in srgb, var(--err) 55%, transparent); }
|
|
3894
|
+
.kb-pending-cancel:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:2px; }
|
|
3895
|
+
.kb-pending-cancel:disabled { opacity:.6; cursor:default; text-decoration:none; }
|
|
3882
3896
|
|
|
3883
3897
|
/* Stage C/D placeholder — reads as forthcoming, never as a broken blank canvas. */
|
|
3884
3898
|
.kb-placeholder { background:var(--bg); display:flex; align-items:center; justify-content:center; padding:24px;
|
|
@@ -113,7 +113,7 @@ export function snapElevation(z, levels, tol) {
|
|
|
113
113
|
|
|
114
114
|
// Lower wins when two candidates are both within tolerance. Grid intersections rank with member
|
|
115
115
|
// intersections (columns land on them); grid lines below member centerlines.
|
|
116
|
-
const PRECEDENCE = { vertex: 0, intersection: 1, 'grid-int': 1, midpoint: 2, centerline: 3, 'vertical-axis': 4, 'grid-line': 5, level: 1 };
|
|
116
|
+
const PRECEDENCE = { origin: 0, vertex: 0, intersection: 1, 'grid-int': 1, midpoint: 2, centerline: 3, 'vertical-axis': 4, 'grid-line': 5, level: 1 }; // origin = the local UCS origin, ties with a vertex (a deliberate reference point)
|
|
117
117
|
|
|
118
118
|
function closestOnSeg(p, a, b) {
|
|
119
119
|
const ab = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
|
|
@@ -125,7 +125,7 @@ function closestOnSeg(p, a, b) {
|
|
|
125
125
|
|
|
126
126
|
/** The 3D point a candidate proposes for the dragged point. */
|
|
127
127
|
function candidatePoint(c, dragged) {
|
|
128
|
-
if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level') return c.p; // fixed points
|
|
128
|
+
if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level' || c.type === 'origin') return c.p; // fixed points
|
|
129
129
|
if (c.type === 'vertical-axis') return [c.p[0], c.p[1], dragged[2]]; // lock plan X/Y to the axis, keep dragged Z
|
|
130
130
|
if (c.type === 'grid-int') return [c.p[0], c.p[1], dragged[2]]; // grid steers PLAN only — never yanks the elevation
|
|
131
131
|
if (c.type === 'grid-line') { const q = closestOnSeg(dragged, c.a, c.b); return [q[0], q[1], dragged[2]]; }
|
|
@@ -182,20 +182,21 @@ export function projectToPlane(p, origin, normal) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
185
|
+
* Does a candidate's proposed point (for `dragged`) lie ON the plane (origin,normal), within `tolMm`?
|
|
186
|
+
* Backs the 3D "workplane-only" snap mode (the SNAP-bar 3D toggle, off). `dragged` here is the cursor's
|
|
187
|
+
* point already resolved on the working plane. On a HORIZONTAL working plane, plan-steering candidates
|
|
188
|
+
* (columns / grid) keep the dragged Z (see candidatePoint), which IS the level, so they lie on the plane
|
|
189
|
+
* and stay snappable; a fixed point (end / mid / intersection) or a centerline passes only where it
|
|
190
|
+
* genuinely meets the plane. On a TILTED plane a plan-steering candidate's own X/Y pushes it off, so it
|
|
191
|
+
* would drop — hence the caller (candOnActiveWP) only applies this gate on a level plane. Pure — no DOM.
|
|
192
|
+
* The signed distance uses the full normalized normal, so it is correct for any orientation. tolMm
|
|
193
|
+
* defaults to 1 mm (on-plane candidates land exactly — Z is tos_inches × 25.4 — this only absorbs rounding).
|
|
191
194
|
*/
|
|
192
|
-
export function
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const w = [rayO[0] - axisP[0], rayO[1] - axisP[1], rayO[2] - axisP[2]];
|
|
198
|
-
return (_dot(n, w) - b * _dot(r, w)) / denom; // t = (e − b·d)/denom, unit basis so a=c=1
|
|
195
|
+
export function candidateOnPlane(c, dragged, origin, normal, tolMm = 1) {
|
|
196
|
+
const p = candidatePoint(c, dragged);
|
|
197
|
+
const n = _norm(normal) || [0, 0, 1];
|
|
198
|
+
const d = (p[0] - origin[0]) * n[0] + (p[1] - origin[1]) * n[1] + (p[2] - origin[2]) * n[2];
|
|
199
|
+
return Math.abs(d) <= tolMm;
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
/** Plane from 3 picked points (Tekla flow): origin=a, xAxis toward b, normal = x̂ × (c−a). null when degenerate. */
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as THREE from 'three';
|
|
18
18
|
import { OrbitControls } from 'three/addons/OrbitControls.js';
|
|
19
19
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
20
|
-
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, planeBasis, planeFrom3Points, vecToPlane, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor,
|
|
20
|
+
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, planeBasis, planeFrom3Points, vecToPlane, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane } from './steel-3d-core.js';
|
|
21
21
|
import { gridGeometry, gridCandidates3d, mmPerPx } from './grid-core.js';
|
|
22
22
|
|
|
23
23
|
let renderer, scene, perspCam, orthoCam, camera, controls, root, api, canvasEl, ro, rafId, grid, raycaster, downXY, lastPick = '(none)';
|
|
@@ -78,6 +78,24 @@ function candAllowed3d(type) {
|
|
|
78
78
|
const pref = api && api.snapEnabled && api.snapEnabled(); const k = SNAP3D_PREF[type];
|
|
79
79
|
return !k || !pref || pref[k] !== false;
|
|
80
80
|
}
|
|
81
|
+
// The SNAP-bar "3D snapping" toggle (⋯ menu → Snapping; default ON). ON = snap freely to any point in
|
|
82
|
+
// 3D at any elevation (Pawel D5 — the whole model is a snap target). OFF = constrain PLACEMENT snapping
|
|
83
|
+
// (Move/Copy/Add-member) to the current working LEVEL: only candidates whose proposed point lands on
|
|
84
|
+
// effectiveWP() survive, so on a horizontal working plane grid lines and columns still snap (they keep
|
|
85
|
+
// the cursor Z, which IS the level) while a beam end on a DIFFERENT elevation drops out instead of
|
|
86
|
+
// yanking the point off-plane. The constraint is a LEVEL constraint, so it only engages on a (near-)
|
|
87
|
+
// horizontal working plane; on a tilted ◇ Plane / local-UCS it does NOT gate (there a plan-steering
|
|
88
|
+
// candidate's own X/Y pushes it off the tilt — gating would silently drop grid/columns), so snapping
|
|
89
|
+
// stays free there. Dimensions stay free 3D (they measure across elevations). Read live from the editor
|
|
90
|
+
// per hover so the toggle is instant — no candidate-cache rebuild. `dragged` is the cursor on the plane.
|
|
91
|
+
const WP_SNAP_TOL_MM = 1;
|
|
92
|
+
function candOnActiveWP(c, dragged, wp) {
|
|
93
|
+
if (!api || !api.snap3dFree || api.snap3dFree()) return true; // free 3D (default) → no plane constraint
|
|
94
|
+
if (!wp || !wp.normal || !wp.origin) return true; // no valid plane → fail open (free); never throw out of the .filter() and break the pointer interaction
|
|
95
|
+
const n = wp.normal, L = Math.hypot(n[0], n[1], n[2]) || 1;
|
|
96
|
+
if (Math.abs(n[2]) <= 0.999 * L) return true; // not a level (tilted/vertical plane) → don't gate; see above
|
|
97
|
+
return candidateOnPlane(c, dragged, wp.origin, wp.normal, WP_SNAP_TOL_MM);
|
|
98
|
+
}
|
|
81
99
|
let rightDownXY = null, rightMoved = false; // right button: dragged (= orbit/pan, no menu) vs clicked (= snap menu)
|
|
82
100
|
let dimAxis3d = 'free'; // sticky axis: free | x | y | z
|
|
83
101
|
let dims3dVisibleFlag = true; // show/hide placed dims
|
|
@@ -605,6 +623,7 @@ function buildFromScene(sc) {
|
|
|
605
623
|
box.expandByObject(mesh);
|
|
606
624
|
}
|
|
607
625
|
sceneBox = box.clone();
|
|
626
|
+
renderWorkPlane(); // re-draw the gizmo + reference plane sized to the (possibly new) model bounds
|
|
608
627
|
// Retain the dim-relevant parts (plates + copes) so the legend's DIMENSIONS overlays can be derived
|
|
609
628
|
// from the resolved geometry — fin-plate holes give bolt pitch/edge clearance, cuts give cope size.
|
|
610
629
|
// (computeOverlayDims scopes the plate path to group 'shear-plate' — base/washer plates are skipped there.)
|
|
@@ -627,15 +646,8 @@ let sceneGroups = [];
|
|
|
627
646
|
// opacity — no white grid (per the baseline). Rebuilt with the model so it always fits.
|
|
628
647
|
function buildGrid(box) {
|
|
629
648
|
if (grid) { scene.remove(grid); grid.geometry.dispose(); grid.material.dispose(); grid = null; }
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const span = Math.max(size.x, size.y) * 1.6 || 5000;
|
|
633
|
-
grid = new THREE.GridHelper(span, 24, 0x1e293b, 0x1e293b); // --line (slate-800)
|
|
634
|
-
grid.material.transparent = true; grid.material.opacity = 0.35;
|
|
635
|
-
grid.rotation.x = Math.PI / 2; // GridHelper is XZ by default → rotate to XY for Z-up
|
|
636
|
-
const c = box.getCenter(new THREE.Vector3());
|
|
637
|
-
grid.position.set(c.x, c.y, box.min.z); // ground at the lowest member
|
|
638
|
-
scene.add(grid);
|
|
649
|
+
// Default 3D floor grid disabled (Pawel 2026-07-13): the plan grid (buildStructGrid — our own grid object)
|
|
650
|
+
// is the ground reference, so the built-in GridHelper is redundant clutter.
|
|
639
651
|
}
|
|
640
652
|
|
|
641
653
|
// Optional reference lines: the work-line (between the two end dots) of every member — the centreline
|
|
@@ -875,8 +887,16 @@ function positionSelLenLabels() {
|
|
|
875
887
|
let structGridGroup = null, gridLabelGroup = null;
|
|
876
888
|
const gridTexCache = new Map(); // 'b:LABEL' bubble / 't:LABEL' tag -> CanvasTexture (kept until dispose)
|
|
877
889
|
|
|
890
|
+
// Snap targets for the 3D tools. Members come from the WHOLE model — every sheet, not just the active
|
|
891
|
+
// one — so "3D snapping on" can grab any member at any elevation (the 3D scene shows all sheets; snapping
|
|
892
|
+
// must match). Each sheet is resolved in its OWN px→ft scale (sheets may differ); the elevation (Z) is
|
|
893
|
+
// scale-independent. Intersections stay within a sheet (pairwise across the whole model is O(n²) noise).
|
|
894
|
+
// Grid is the active sheet's (the plan-locked reference the user is drawing against).
|
|
878
895
|
function allCandidates(excludeId) {
|
|
879
|
-
const
|
|
896
|
+
const dtos = api.defaultTosMm();
|
|
897
|
+
const byPlan = (api.membersByPlan && api.membersByPlan()) || [{ members: members(), ptPerFt: api.ptPerFt(), defaultTosMm: dtos }];
|
|
898
|
+
const base = byPlan.flatMap((pl) => snapCandidates(pl.members, pl.ptPerFt, pl.defaultTosMm != null ? pl.defaultTosMm : dtos, excludeId)); // each sheet's OWN default T.O.S — a default-elevation member on a non-active sheet must snap at the level it RENDERS at (the bake uses the same per-plan default), not the active sheet's
|
|
899
|
+
if (frame3d && !(pending && pending.frameDrag)) base.push({ type: 'origin', p: [...frame3d.origin], fromId: 'ucs-origin' }); // the local UCS origin is a snap target for every tool (Move/Copy, Add, Dimension); excluded while dragging the origin itself → no self-snap
|
|
880
900
|
try { return base.concat(gridCandidates3d(api.getGrid ? api.getGrid() : null, api.ptPerFt())); }
|
|
881
901
|
catch { return base; } // a malformed hand-edited grid must never break member dragging
|
|
882
902
|
}
|
|
@@ -1284,7 +1304,7 @@ function setClipState(s) {
|
|
|
1284
1304
|
else workArea = null;
|
|
1285
1305
|
selectedClipIds = new Set(s.selected || []);
|
|
1286
1306
|
if (typeof s.seq === 'number') clipSeq = Math.max(clipSeq, s.seq);
|
|
1287
|
-
applyClips(); renderClipGizmo(); renderWorkArea(); refreshWorkAreaVis();
|
|
1307
|
+
applyClips(); renderClipGizmo(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
|
|
1288
1308
|
if (api && api.onClipsChange) api.onClipsChange();
|
|
1289
1309
|
if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState()); // undo/redo of a work-area edit must resync the Work-area button + its sliders, not just the model
|
|
1290
1310
|
}
|
|
@@ -1466,7 +1486,7 @@ function setWorkAreaBox(box) {
|
|
|
1466
1486
|
if (api && api.beginClipEdit) api.beginClipEdit(); // undoable
|
|
1467
1487
|
const whole = workArea ? workArea.whole : true; // keep the current cut/whole mode across a re-define; a brand-new work area defaults to "show whole parts" (no surprise slicing)
|
|
1468
1488
|
workArea = { enabled: true, whole, planes: boxToPlanes(box), box: box.clone() };
|
|
1469
|
-
applyClips(); renderWorkArea(); refreshWorkAreaVis();
|
|
1489
|
+
applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
|
|
1470
1490
|
if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
|
|
1471
1491
|
return true;
|
|
1472
1492
|
}
|
|
@@ -1479,7 +1499,7 @@ function workAreaToggle(on) {
|
|
|
1479
1499
|
if (!workArea) return on === false ? false : workAreaSetAll(); // first toggle-on with no box → bound the whole model
|
|
1480
1500
|
if (api && api.beginClipEdit) api.beginClipEdit(); // undoable
|
|
1481
1501
|
workArea.enabled = on === undefined ? !workArea.enabled : !!on;
|
|
1482
|
-
applyClips(); renderWorkArea(); refreshWorkAreaVis();
|
|
1502
|
+
applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
|
|
1483
1503
|
if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
|
|
1484
1504
|
return workArea.enabled;
|
|
1485
1505
|
}
|
|
@@ -1493,7 +1513,7 @@ function workAreaSetWhole(on) {
|
|
|
1493
1513
|
if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
|
|
1494
1514
|
return workArea.whole;
|
|
1495
1515
|
}
|
|
1496
|
-
function clearWorkArea() { if (api && api.beginClipEdit && workArea) api.beginClipEdit(); workArea = null; applyClips(); renderWorkArea(); refreshWorkAreaVis(); if (api && api.onWorkAreaChange) api.onWorkAreaChange(null); }
|
|
1516
|
+
function clearWorkArea() { if (api && api.beginClipEdit && workArea) api.beginClipEdit(); workArea = null; applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane(); if (api && api.onWorkAreaChange) api.onWorkAreaChange(null); }
|
|
1497
1517
|
function workAreaState() { return workArea ? { on: workArea.enabled, whole: !!workArea.whole } : null; }
|
|
1498
1518
|
// The camera viewpoint as plain data — position + orbit target + projection + the ortho frustum half-height
|
|
1499
1519
|
// and zoom. A saved view restores it via setCameraState. (perspCam/orthoCam share position; orthoBaseH+zoom
|
|
@@ -1557,6 +1577,7 @@ function onKey(e) {
|
|
|
1557
1577
|
if (pending && pending.clipDrag && e.key === 'Escape') { e.preventDefault(); const p = pending; if (p.plane) p.clip.point = p.prePoint; else p.clip.box.copy(p.preBox); rebuildClipPlanes(p.clip); applyClips(); renderClipGizmo(); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; return; } // Esc mid-drag → undo the handle move
|
|
1558
1578
|
if (framePicking() && e.key === 'Escape') { e.preventDefault(); if (frame3d) { cancelFramePick(); fireFrameChange(); } else armFrame3d(false); return; } // Esc cancels the whole 3-click pick (discards partial clicks); no prior frame → also exit the tool
|
|
1559
1579
|
if (pending && pending.frameDrag && e.key === 'Escape') { e.preventDefault(); if (frame3d && pending.preFrame) frame3d = cloneFrame(pending.preFrame); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; fireFrameChange(); return; } // Esc mid-drag → revert the frame to its pre-drag basis
|
|
1580
|
+
if (frameMode && e.key === 'Escape' && !pending) { e.preventDefault(); disarmFrame3d(); return; } // armed but idle (frame set, gizmo grabbable for refine) → Esc exits the "Set local axes" tool (the frame stays; it just stops being editable). `!pending` so a mid-gesture Esc (member move / endpoint stretch, reachable while the tool is armed) still falls through to the cancel-and-revert below instead of silently committing (code-review) (frame set, gizmo grabbable for refine) → Esc exits the "Set local axes" tool (the frame stays; it just stops being editable). `!pending` so a mid-gesture Esc (member move / endpoint stretch, reachable while the tool is armed) still falls through to the cancel-and-revert below instead of silently committing (code-review)
|
|
1560
1581
|
if (pending && e.key === 'Escape' && (pending.epDrag || pending.origMm)) { // Esc mid-drag → cancel a member move / endpoint stretch and revert to the pre-drag state (no commit)
|
|
1561
1582
|
e.preventDefault();
|
|
1562
1583
|
if (pending.mesh && pending.meshPos0) pending.mesh.position.copy(pending.meshPos0); // put a live-moved (or Alt-vertical) member mesh back
|
|
@@ -2329,7 +2350,7 @@ function frameInfo() {
|
|
|
2329
2350
|
}
|
|
2330
2351
|
return { mode: 'global' };
|
|
2331
2352
|
}
|
|
2332
|
-
function fireFrameChange() { invalidatePointEntry('drift');
|
|
2353
|
+
function fireFrameChange() { invalidatePointEntry('drift'); if (!(pending && pending.frameDrag)) { tfCandidates = null; dimCandidates3d = null; } renderWorkPlane(); } // re-draws the gizmo + reference plane + fires the Axes chip; invalidates the typed HUD (drift) + the snap caches so the UCS-origin snap follows the frame — but NOT during a live origin drag (the drag's own snap cache, which excludes the origin, stays efficient)
|
|
2333
2354
|
// Set a HORIZONTAL frame at origin (numeric entry + gizmo materialize). origin defaults its Z to the active level.
|
|
2334
2355
|
function setFrame3d(originMm, angleDeg) {
|
|
2335
2356
|
const z = (originMm && originMm.length > 2) ? originMm[2] : frameZ();
|
|
@@ -2367,16 +2388,12 @@ let frameGizmo = null;
|
|
|
2367
2388
|
function disposeFrameGizmo() { if (!frameGizmo) return; if (overlayScene) overlayScene.remove(frameGizmo); frameGizmo.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); frameGizmo = null; }
|
|
2368
2389
|
function renderFrameGizmo() {
|
|
2369
2390
|
disposeFrameGizmo();
|
|
2370
|
-
if (!overlayScene
|
|
2371
|
-
const
|
|
2372
|
-
const O
|
|
2373
|
-
const u = new THREE.Vector3(...
|
|
2391
|
+
if (!overlayScene) return; // ALWAYS draw the gizmo (matches the reference plane); a ◇ Plane no longer removes it
|
|
2392
|
+
const on = frameMode && !workPlane; // grabbable/armed only when the LOCAL frame is the active basis (a ◇ Plane is picked, not gizmo-dragged)
|
|
2393
|
+
const { O, u: ux, v: uy, n: uz } = refPlaneBasis(); // effective basis the tools follow: ◇ Plane > local frame > global
|
|
2394
|
+
const u = new THREE.Vector3(...ux), v = new THREE.Vector3(...uy), n = new THREE.Vector3(...uz);
|
|
2374
2395
|
const g = new THREE.Group();
|
|
2375
|
-
const CELL = 1524, N =
|
|
2376
|
-
const verts = []; for (let i = 0; i <= N; i++) { const o = -half + i * CELL; verts.push(o, -half, 0, o, half, 0, -half, o, 0, half, o, 0); }
|
|
2377
|
-
const grid = new THREE.BufferGeometry(); grid.setAttribute('position', new THREE.Float32BufferAttribute(verts, 3));
|
|
2378
|
-
g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.3 : 0.14 })));
|
|
2379
|
-
g.add(new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.1 : 0.05, side: THREE.DoubleSide, depthWrite: false })));
|
|
2396
|
+
const CELL = 1524, N = 2, half = (CELL * N) / 2; // half = axis length (5 ft). The gizmo is just axes + origin now — NO grid patch (the reference plane is the separate "Show plane").
|
|
2380
2397
|
const axis = (len, col, vx, vy, vz) => { const l = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(vx * len, vy * len, vz * len)]), new THREE.LineBasicMaterial({ color: col, transparent: true, opacity: 0.95 })); l.renderOrder = 997; return l; };
|
|
2381
2398
|
g.add(axis(half, 0xef4444, 1, 0, 0)); // local X = red
|
|
2382
2399
|
g.add(axis(half, 0x22c55e, 0, 1, 0)); // local Y = green
|
|
@@ -2400,15 +2417,16 @@ function sizeFrameHandle() {
|
|
|
2400
2417
|
for (const h of frameGizmo.children) if (h.userData && h.userData.frameHandle === 'origin') h.scale.setScalar(r);
|
|
2401
2418
|
}
|
|
2402
2419
|
// --- frame manipulator: grab + drag the gizmo's origin (translate) or ring (rotate about Z). Armed only. ---
|
|
2403
|
-
const FRAME_RING_R = (1524 *
|
|
2404
|
-
function frameGizmoOrigin() { return frame3d ? frame3d.origin : [0, 0,
|
|
2405
|
-
function pickFrameHandle(cx, cy) {
|
|
2406
|
-
if (!frameMode || !overlayScene || workPlane || !canvasEl) return null;
|
|
2420
|
+
const FRAME_RING_R = (1524 * 2 / 2) * 0.8; // ring radius (matches renderFrameGizmo's half*0.8, N=2)
|
|
2421
|
+
function frameGizmoOrigin() { return frame3d ? frame3d.origin : [0, 0, 0]; } // Global → true global 0,0,0
|
|
2422
|
+
function pickFrameHandle(cx, cy, allowPassive) { // → 'origin' | 'ring' | null (screen-space, like pickClipHandle). allowPassive: hit-test the un-armed (passive) gizmo too, for click-to-re-select.
|
|
2423
|
+
if ((!frameMode && !allowPassive) || !overlayScene || workPlane || !canvasEl) return null;
|
|
2407
2424
|
camera.updateMatrixWorld();
|
|
2408
2425
|
const rect = canvasEl.getBoundingClientRect(), px = cx - rect.left, py = cy - rect.top;
|
|
2409
2426
|
const O = frameGizmoOrigin();
|
|
2410
2427
|
const toS = (p) => { const w = new THREE.Vector3(p[0], p[1], p[2]).project(camera); return w.z > 1 ? null : [(w.x * 0.5 + 0.5) * rect.width, (-w.y * 0.5 + 0.5) * rect.height]; };
|
|
2411
2428
|
const os = toS(O); if (os && Math.hypot(os[0] - px, os[1] - py) <= 16) return 'origin';
|
|
2429
|
+
if (!frameMode) return null; // passive gizmo (allowPassive re-select): only the VISIBLE origin dot is grabbable — the rotation ring isn't drawn when idle, so don't hit-test its invisible band (would steal a member click / box-select and rotate by accident) (code-review)
|
|
2412
2430
|
const u = frame3d ? frame3d.xAxis : [1, 0, 0], v = frame3d ? frame3d.yAxis : [0, 1, 0]; let bestD = 12; // ring lies in the frame's X-Y plane — sample all THREE coords so a tilted ring's grab matches the drawn ring
|
|
2413
2431
|
for (let i = 0; i < 48; i++) { const ph = i / 48 * Math.PI * 2, c = Math.cos(ph), s = Math.sin(ph);
|
|
2414
2432
|
const ss = toS([O[0] + FRAME_RING_R * (c * u[0] + s * v[0]), O[1] + FRAME_RING_R * (c * u[1] + s * v[1]), O[2] + FRAME_RING_R * (c * u[2] + s * v[2])]);
|
|
@@ -2534,28 +2552,46 @@ function orthoLockDelta(dx, dy) {
|
|
|
2534
2552
|
const du = dx * u[0] + dy * u[1], dv = dx * v[0] + dy * v[1];
|
|
2535
2553
|
return Math.abs(du) >= Math.abs(dv) ? [du * u[0], du * u[1]] : [dv * v[0], dv * v[1]];
|
|
2536
2554
|
}
|
|
2555
|
+
// The unified "Show plane" REFERENCE PLANE (Pawel 2026-07-13): a transparent, gridded plane that MATCHES the
|
|
2556
|
+
// working plane the tools actually follow — a ◇ Plane if set, else the local frame (tilted), else horizontal
|
|
2557
|
+
// at the global origin. Sized to the Work area (if set) else the model. The axes+origin gizmo always draws on
|
|
2558
|
+
// top of it (renderFrameGizmo, never shadowed). Toggled by "Show plane" (wpVisible).
|
|
2559
|
+
function refPlaneBasis() {
|
|
2560
|
+
if (workPlane) { const b = planeBasis(workPlane.normal, workPlane.xAxis); return { O: workPlane.origin, u: b.u, v: b.v, n: workPlane.normal }; }
|
|
2561
|
+
if (frame3d) return { O: frame3d.origin, u: frame3d.xAxis, v: frame3d.yAxis, n: frame3d.normal };
|
|
2562
|
+
return { O: frameGizmoOrigin(), u: [1, 0, 0], v: [0, 1, 0], n: [0, 0, 1] }; // Global → horizontal at 0,0,0
|
|
2563
|
+
}
|
|
2537
2564
|
function renderWorkPlane() {
|
|
2538
|
-
renderFrameGizmo(); //
|
|
2539
|
-
if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); //
|
|
2565
|
+
renderFrameGizmo(); // the axes+origin gizmo always draws (matches the plane; never shadowed)
|
|
2566
|
+
if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); // refresh the Axes chip: "Plane" when a plane is set, back to Local/Global when cleared
|
|
2540
2567
|
if (wpGroup) { scene.remove(wpGroup); wpGroup.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); wpGroup = null; }
|
|
2541
|
-
if (!
|
|
2542
|
-
|
|
2543
|
-
|
|
2568
|
+
if (!wpVisible || !scene) return; // "Show plane" off → no reference plane (works at Global too now, not only for a ◇ Plane)
|
|
2569
|
+
// Draw AT the true pick plane (effectiveWP = where a click actually lands), NOT the 0,0,0 gizmo origin.
|
|
2570
|
+
// For a local frame / ◇ Plane these coincide; only at Global do they differ (plane at the active level's
|
|
2571
|
+
// TOS, gizmo at world 0,0,0) — so the plane never lies about the work height (code-review High).
|
|
2572
|
+
const wp = effectiveWP(), { u, v } = planeBasis(wp.normal, wp.xAxis), O = wp.origin, n = wp.normal;
|
|
2573
|
+
const CELL = 1524; let span = 6096; // size to the Work area if set, else the model bbox, + a margin
|
|
2574
|
+
const box = (workArea && workArea.enabled && workArea.box && !workArea.box.isEmpty()) ? workArea.box : sceneBox;
|
|
2575
|
+
if (box && !box.isEmpty()) { // project the bbox corners onto the plane's OWN u/v so a tilted/vertical (XZ/YZ) plane spans its model in-plane, not by world X/Y (code-review)
|
|
2576
|
+
let uMin = Infinity, uMax = -Infinity, vMin = Infinity, vMax = -Infinity;
|
|
2577
|
+
for (const x of [box.min.x, box.max.x]) for (const y of [box.min.y, box.max.y]) for (const z of [box.min.z, box.max.z]) {
|
|
2578
|
+
const dx = x - O[0], dy = y - O[1], dz = z - O[2];
|
|
2579
|
+
const pu = dx * u[0] + dy * u[1] + dz * u[2], pv = dx * v[0] + dy * v[1] + dz * v[2];
|
|
2580
|
+
uMin = Math.min(uMin, pu); uMax = Math.max(uMax, pu); vMin = Math.min(vMin, pv); vMax = Math.max(vMax, pv);
|
|
2581
|
+
}
|
|
2582
|
+
span = Math.max(uMax - uMin, vMax - vMin, 3048) * 1.15;
|
|
2583
|
+
}
|
|
2584
|
+
const N = Math.min(160, Math.max(2, Math.ceil(span / CELL))), half = (CELL * N) / 2; // N capped: a huge (or degenerate) bbox must never allocate thousands of lines, rebuilt every frame-drag move (code-review)
|
|
2544
2585
|
const g = new THREE.Group();
|
|
2545
2586
|
const verts = [];
|
|
2546
2587
|
for (let i = 0; i <= N; i++) { const o = -half + i * CELL; verts.push(o, -half, 0, o, half, 0, -half, o, 0, half, o, 0); }
|
|
2547
2588
|
const grid = new THREE.BufferGeometry(); grid.setAttribute('position', new THREE.Float32BufferAttribute(verts, 3));
|
|
2548
|
-
g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
ay.renderOrder = 996; g.add(ay); // the shorter, dimmer ray = local Y (tells the axes apart on a skewed plane)
|
|
2555
|
-
const od = new THREE.Mesh(new THREE.SphereGeometry(60, 12, 8), new THREE.MeshBasicMaterial({ color: 0x3b82f6 }));
|
|
2556
|
-
g.add(od); // origin dot
|
|
2557
|
-
g.applyMatrix4(new THREE.Matrix4().makeBasis(new THREE.Vector3(...u), new THREE.Vector3(...v), new THREE.Vector3(...wp.normal)));
|
|
2558
|
-
g.position.set(wp.origin[0], wp.origin[1], wp.origin[2]);
|
|
2589
|
+
g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.2 })));
|
|
2590
|
+
g.add(new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.05, side: THREE.DoubleSide, depthWrite: false }))); // just a transparent plane + grid (the gizmo carries the axes)
|
|
2591
|
+
const edge = [new THREE.Vector3(-half, -half, 0), new THREE.Vector3(half, -half, 0), new THREE.Vector3(half, half, 0), new THREE.Vector3(-half, half, 0)];
|
|
2592
|
+
g.add(new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(edge), new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.42 }))); // brighter perimeter so the plane's extent reads now that it's sized to the work-area/model (ux review)
|
|
2593
|
+
g.applyMatrix4(new THREE.Matrix4().makeBasis(new THREE.Vector3(...u), new THREE.Vector3(...v), new THREE.Vector3(...n)));
|
|
2594
|
+
g.position.set(O[0], O[1], O[2]);
|
|
2559
2595
|
wpGroup = g; scene.add(g); // on `scene` (like epGroup) so rebuild() never wipes it; not in meshById → picking ignores it
|
|
2560
2596
|
}
|
|
2561
2597
|
function reflectWpBar() { const b = document.getElementById('m3dWp'); if (b) { b.classList.toggle('on', !!wpMode || !!workPlane);
|
|
@@ -2594,15 +2630,6 @@ function rayToWP(cx, cy, wp) {
|
|
|
2594
2630
|
const hit = new THREE.Vector3();
|
|
2595
2631
|
return raycaster.ray.intersectPlane(plane, hit) ? [hit.x, hit.y, hit.z] : null;
|
|
2596
2632
|
}
|
|
2597
|
-
// The cursor's world-space pick ray {o, d} (d unit), mirroring rayToWP's NDC → raycaster setup.
|
|
2598
|
-
function cameraRay(cx, cy) {
|
|
2599
|
-
camera.updateMatrixWorld();
|
|
2600
|
-
const rect = canvasEl.getBoundingClientRect(); if (!rect.width || !rect.height) return null;
|
|
2601
|
-
const ndc = new THREE.Vector2(((cx - rect.left) / rect.width) * 2 - 1, -((cy - rect.top) / rect.height) * 2 + 1);
|
|
2602
|
-
raycaster.setFromCamera(ndc, camera);
|
|
2603
|
-
const o = raycaster.ray.origin, d = raycaster.ray.direction;
|
|
2604
|
-
return { o: [o.x, o.y, o.z], d: [d.x, d.y, d.z] };
|
|
2605
|
-
}
|
|
2606
2633
|
|
|
2607
2634
|
// ---- 3D Move/Copy (spec §3+§6): the EDITOR owns the tool state (cmState via api); this side owns
|
|
2608
2635
|
// picking/preview in scene mm against the working plane, and hands commit offsets back. ----
|
|
@@ -2610,14 +2637,25 @@ let tfDraft = null; // {base:[mm], vA:[mm]|null}
|
|
|
2610
2637
|
let tfLastShift = false; // shiftKey mirror for the rAF-synthetic hover event
|
|
2611
2638
|
let tfLast = null; // last constrained preview point (HUD distance direction)
|
|
2612
2639
|
let tfLastClient = null; // last pointer client [x,y] (HUD placement)
|
|
2613
|
-
|
|
2640
|
+
const tfLock = new Set(); // subset of {'u','v','n'} the move is LINE-locked to — 0 = free; 1 = that axis; 2 or 3 = whichever locked axis the cursor drags toward (dominantAmong). Multi-axis lock; UCS Stage 4.
|
|
2614
2641
|
let tfCandidates = null;
|
|
2615
2642
|
let tfGhost = null, tfRubber = null, tfRubberA = null, tfGhostMat = null;
|
|
2616
2643
|
const cmActive = () => (api && api.cmState ? api.cmState() : null);
|
|
2617
2644
|
const cmHasBase = () => !!tfDraft;
|
|
2618
2645
|
const cmLastClient = () => tfLastClient;
|
|
2619
|
-
|
|
2620
|
-
|
|
2646
|
+
// X/Y/Z each TOGGLE their axis in the lock set (press again to release, press another to ADD → the move
|
|
2647
|
+
// snaps to whichever locked axis you drag toward); F clears to free. shiftHeld = the Shift state at the key
|
|
2648
|
+
// press (the editor passes it), so the immediate preview refresh matches a click.
|
|
2649
|
+
function setCmAxis(a, shiftHeld) {
|
|
2650
|
+
const ax = a === 'x' ? 'u' : a === 'y' ? 'v' : a === 'z' ? 'n' : null;
|
|
2651
|
+
if (ax === null) tfLock.clear(); else if (tfLock.has(ax)) tfLock.delete(ax); else tfLock.add(ax);
|
|
2652
|
+
// Refresh the ghost/readout NOW so a key press then a click WITHOUT moving commits what's shown. The
|
|
2653
|
+
// editor's axis-key handler fires only with Alt UP, so use altKey:false (NOT the stale hover mirror
|
|
2654
|
+
// dimLastAlt, which lags a modifier released without a pointer move); Shift comes live from the key event.
|
|
2655
|
+
if (tfDraft && lastHoverXY) tfPreview({ clientX: lastHoverXY[0], clientY: lastHoverXY[1], altKey: false, shiftKey: !!shiftHeld });
|
|
2656
|
+
updateStatusChip();
|
|
2657
|
+
}
|
|
2658
|
+
function cmClear3d() { tfDraft = null; tfCandidates = null; tfLock.clear(); tfPreviewClear(); if (canvasEl) canvasEl.style.cursor = 'default'; } // callable BEFORE init() (editor boot) — every touched handle is guarded
|
|
2621
2659
|
function cmEscape() { if (!tfDraft) return false; if (tfDraft.vA) { tfDraft.vA = null; tfPreviewClear(); return true; } tfDraft = null; tfPreviewClear(); return true; }
|
|
2622
2660
|
function tfDisposeGhost() { if (!tfGhost) return; if (scene) scene.remove(tfGhost); for (const c of tfGhost.children) { if (c.userData._ownGeom && c.geometry) c.geometry.dispose(); } tfGhost = null; } // clones share the source geometry/material; only the >600 fallback BoxGeometry is per-ghost → dispose those (flagged _ownGeom) so the preview can't leak
|
|
2623
2661
|
function tfPreviewClear() { tfDisposeGhost(); if (tfRubber) tfRubber.visible = false; if (tfRubberA) tfRubberA.visible = false; if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; }
|
|
@@ -2627,62 +2665,76 @@ function wpPointAt(e) {
|
|
|
2627
2665
|
const hit = rayToWP(e.clientX, e.clientY, wp); if (!hit) return null;
|
|
2628
2666
|
if (!e.altKey) {
|
|
2629
2667
|
if (!tfCandidates) tfCandidates = allCandidates(null); // members + grid, so Move/Copy + draw-on-plane snap to the grid too
|
|
2630
|
-
const
|
|
2631
|
-
|
|
2668
|
+
const cands = tfCandidates.filter((c) => candAllowed3d(c.type) && candOnActiveWP(c, hit, wp)); // running-snaps / override, then (3D toggle off) the working-plane constraint
|
|
2669
|
+
const r = snapPoint(hit, cands, toScreen, SNAP_TOL_PX);
|
|
2670
|
+
if (r.candidate) return { p: r.snapped, snap: true, type: r.candidate.type }; // land on the TRUE 3D snap (member end / grid) when the SNAP-bar 3D toggle is ON — free to the whole model, same as global (Pawel D5); OFF constrains to the working plane above; a free (non-snapped) click still rides the plane below
|
|
2632
2671
|
}
|
|
2633
2672
|
return { p: hit, snap: false, type: null };
|
|
2634
2673
|
}
|
|
2635
|
-
//
|
|
2636
|
-
function
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
const dy = bs.y - (e.clientY - rect.top); // cursor above the base → +normal (fixed sign)
|
|
2658
|
-
t = dy * pxToWorldAt(1, base);
|
|
2659
|
-
// ponytail: uses the horizontal px→world scale as the vertical proxy (a straight-down view has no true
|
|
2660
|
-
// vertical scale). Fine for the rare look-down-the-normal case; the level snap fixes the landing.
|
|
2661
|
-
}
|
|
2662
|
-
if (!Number.isFinite(t)) t = 0; // never commit a NaN offset — a non-finite scale/ray pins the destination to the base (no move)
|
|
2674
|
+
// Basis of the active frame: in-plane u/v (from the plane basis) + the normal n.
|
|
2675
|
+
function frameBasis() { const wp = effectiveWP(), b = planeBasis(wp.normal, wp.xAxis); return { u: b.u || [1, 0, 0], v: b.v || [0, 1, 0], n: _unit3(wp.normal) }; }
|
|
2676
|
+
// Line-lock the Move/Copy destination to ONE axis via a SCREEN-space drag: move along the axis in
|
|
2677
|
+
// proportion to how far the cursor is dragged along the axis's on-screen direction. This tracks the cursor
|
|
2678
|
+
// and is bounded by the actual drag — unlike a working-plane-hit projection it does NOT blow up to a huge
|
|
2679
|
+
// offset when the cursor nears the horizon (the axis grazes the view). Edge-on axis (its screen projection
|
|
2680
|
+
// collapses because you're looking down it): a ~vertical axis falls back to screen-Y → Z (Top view); any
|
|
2681
|
+
// other axis → no move. A ~vertical axis then snaps t to the framing levels. X/Y/Z + Alt normal-lock alike.
|
|
2682
|
+
function cmAxisLock(e, axisVec) {
|
|
2683
|
+
const base = tfDraft.base, n = _unit3(axisVec), bs = toScreen(base), rect = canvasEl.getBoundingClientRect();
|
|
2684
|
+
const sc = pxToWorldAt(120, base) || 1; // a world length that spans ~120 px at the base
|
|
2685
|
+
const q = toScreen([base[0] + n[0] * sc, base[1] + n[1] * sc, base[2] + n[2] * sc]);
|
|
2686
|
+
const sdx = q.x - bs.x, sdy = q.y - bs.y, slen = Math.hypot(sdx, sdy); // the axis's screen vector for `sc` world units
|
|
2687
|
+
let t;
|
|
2688
|
+
if (slen < 4) { // axis ~edge-on (looking down it) → no usable screen direction
|
|
2689
|
+
if (Math.abs(n[2]) > 0.999) t = (bs.y - (e.clientY - rect.top)) * pxToWorldAt(1, base); // vertical axis (Top) → screen-Y → Z
|
|
2690
|
+
else t = 0; // other axis edge-on → no move (orbit, or use typed entry)
|
|
2691
|
+
} else {
|
|
2692
|
+
const cdx = (e.clientX - rect.left) - bs.x, cdy = (e.clientY - rect.top) - bs.y; // cursor's screen offset from the base
|
|
2693
|
+
t = ((cdx * sdx + cdy * sdy) / slen) * (sc / slen); // (signed px along the axis) × (world per screen px along it)
|
|
2694
|
+
}
|
|
2695
|
+
if (!Number.isFinite(t)) t = 0; // never commit a NaN offset
|
|
2663
2696
|
let p = [base[0] + n[0] * t, base[1] + n[1] * t, base[2] + n[2] * t];
|
|
2664
2697
|
let snap = false, type = null;
|
|
2665
|
-
if (Math.abs(n[2]) > 0.999) { // ~vertical
|
|
2666
|
-
// World-space snap (NOT screen-space): in Top view every level projects to the same screen point, so a
|
|
2667
|
-
// screen snap can't tell them apart and would pin to one level regardless of the cursor. Snap p.z to the
|
|
2668
|
-
// nearest level within a screen-proportional world tolerance, then re-solve t so the point stays exactly
|
|
2669
|
-
// on base + t·normal (the normal may tilt a hair even at |n.z| > 0.999).
|
|
2698
|
+
if (Math.abs(n[2]) > 0.999) { // ~vertical axis → snap the elevation to a framing level (WORLD-space: in Top view all levels share one screen point)
|
|
2670
2699
|
const tol = pxToWorldAt(SNAP_TOL_PX, base);
|
|
2671
2700
|
let best = null, bestD = tol;
|
|
2672
2701
|
for (const z of elevationLevels(members(), api.ptPerFt(), api.defaultTosMm(), null)) { const d = Math.abs(p[2] - z); if (d <= bestD) { bestD = d; best = z; } }
|
|
2673
|
-
if (best != null) { t = (best - base[2]) / n[2]; p = [base[0] + n[0] * t, base[1] + n[1] * t, best]; snap = true; type = 'level'; }
|
|
2702
|
+
if (best != null) { t = (best - base[2]) / n[2]; p = [base[0] + n[0] * t, base[1] + n[1] * t, best]; snap = true; type = 'level'; } // re-solve t so the point stays exactly on base + t·axis
|
|
2674
2703
|
}
|
|
2675
2704
|
return { p, snap, type };
|
|
2676
2705
|
}
|
|
2677
|
-
//
|
|
2678
|
-
//
|
|
2679
|
-
// (
|
|
2706
|
+
// Among `axes` (basis keys), the ONE the cursor is dragging toward: the axis whose SCREEN direction best
|
|
2707
|
+
// matches the cursor's screen move from the base (|cos|). Lets a 2-axis lock (X+Z) snap the move to X or Z
|
|
2708
|
+
// (whichever you lean toward), and Shift pick the dominant in-plane axis — one straight axis, never diagonal.
|
|
2709
|
+
function dominantAmong(e, axes) {
|
|
2710
|
+
const base = tfDraft.base, bs = toScreen(base), rect = canvasEl.getBoundingClientRect();
|
|
2711
|
+
const cx = (e.clientX - rect.left) - bs.x, cy = (e.clientY - rect.top) - bs.y, cl = Math.hypot(cx, cy) || 1;
|
|
2712
|
+
const bv = frameBasis(), sc = pxToWorldAt(120, base) || 1; // world length spanning ~120 px → a well-conditioned axis screen vector
|
|
2713
|
+
let best = axes[0], bestScore = -1;
|
|
2714
|
+
for (const a of axes) {
|
|
2715
|
+
const av = bv[a], q = toScreen([base[0] + av[0] * sc, base[1] + av[1] * sc, base[2] + av[2] * sc]);
|
|
2716
|
+
const ax2 = q.x - bs.x, ay2 = q.y - bs.y, al = Math.hypot(ax2, ay2) || 1;
|
|
2717
|
+
const score = Math.abs((cx * ax2 + cy * ay2) / (cl * al));
|
|
2718
|
+
if (score > bestScore) { bestScore = score; best = a; }
|
|
2719
|
+
}
|
|
2720
|
+
return best;
|
|
2721
|
+
}
|
|
2722
|
+
// The single axis the move is line-locked to ('u'|'v'|'n'), or null = free. Precedence: Alt (normal) >
|
|
2723
|
+
// Shift (dominant in-plane) > the sticky lock set (the lone locked axis, or the dominant of two).
|
|
2724
|
+
function cmEffAxis(e) {
|
|
2725
|
+
if (!tfDraft) return null;
|
|
2726
|
+
if (e && e.altKey) return 'n';
|
|
2727
|
+
if (e && e.shiftKey) return dominantAmong(e, ['u', 'v']);
|
|
2728
|
+
if (!tfLock.size) return null; // no lock → free
|
|
2729
|
+
return tfLock.size === 1 ? [...tfLock][0] : dominantAmong(e, [...tfLock]); // 1 = that axis; 2 or 3 = whichever locked axis the cursor drags toward
|
|
2730
|
+
}
|
|
2731
|
+
// Resolve the Move/Copy destination: a line-lock along the effective axis (ray-to-axis), else the free
|
|
2732
|
+
// working-plane pick (with snapping). null = no valid pick (cursor off the plane, edge-on).
|
|
2680
2733
|
function cmDestPoint(e) {
|
|
2681
|
-
const
|
|
2682
|
-
if (
|
|
2734
|
+
const ax = cmEffAxis(e);
|
|
2735
|
+
if (ax) return cmAxisLock(e, frameBasis()[ax]);
|
|
2683
2736
|
const r = wpPointAt(e); if (!r) return null;
|
|
2684
|
-
|
|
2685
|
-
return { p, snap: r.snap && tfAxis === 'free' && !shift, type: r.type }; // in-plane force moves p off the raw snap → no reticle
|
|
2737
|
+
return { p: r.p, snap: r.snap, type: r.type };
|
|
2686
2738
|
}
|
|
2687
2739
|
// the offset list is the pure core `offsetsFor` (unit-tested for linear/grid) — counts INCLUDE the original, grid skips (0,0)
|
|
2688
2740
|
function tfOffsetsFor(v, st) { return offsetsFor(v, st, tfDraft ? tfDraft.vA : null); }
|
|
@@ -2952,6 +3004,10 @@ function onDown(e) {
|
|
|
2952
3004
|
if (clipMode === 'box') { e.stopPropagation(); onClipBoxClick(e); return; } // armed: 2-corner clip-box draw on the floor plane
|
|
2953
3005
|
if (framePicking()) { e.stopPropagation(); controls.enabled = true; framePickClick(e); return; } // 3-click UCS set: this click collects the origin / X point / Y point
|
|
2954
3006
|
if (frameMode) { let fh = null; try { fh = pickFrameHandle(e.clientX, e.clientY); } catch { fh = null; } if (fh) { e.stopPropagation(); controls.enabled = false; startFrameDrag(fh, e); return; } } // grab the local-frame origin/ring (armed) → drag it; an empty click falls through (orbit)
|
|
3007
|
+
if (frame3d && !frameMode && !geoMode() && !cmActive() && !addActive() && !dimMode3d && !clipMode && !wpMode && !basePickCol && !insertMode && !selectedClipIds.size) { // passive gizmo, no tool armed → clicking its origin/ring re-selects the local frame for editing (NOT reached by box-select or select-all, which only touch members)
|
|
3008
|
+
let fh = null; try { fh = pickFrameHandle(e.clientX, e.clientY, true); } catch { fh = null; }
|
|
3009
|
+
if (fh) { e.stopPropagation(); controls.enabled = false; armFrame3d(true); startFrameDrag(fh, e); return; } // re-arm the tool + grab the clicked handle so a click-drag manipulates immediately
|
|
3010
|
+
}
|
|
2955
3011
|
if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(e.clientX, e.clientY); } catch { ch = null; } if (ch) { e.stopPropagation(); controls.enabled = false; downXY = [e.clientX, e.clientY]; startClipDrag(ch, e); return; } } // grab a clip handle (plane dot / box face) → drag it
|
|
2956
3012
|
if (dimMode3d) { // 2-click dimension placement (not a drag): pick A, then B → place
|
|
2957
3013
|
e.stopPropagation(); controls.enabled = true;
|
|
@@ -3214,7 +3270,7 @@ function onUp(e) {
|
|
|
3214
3270
|
const moved = downXY ? Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) : Infinity; downXY = null;
|
|
3215
3271
|
if (!p) return;
|
|
3216
3272
|
if (p.clipDrag) return; // a clip handle drag is applied live during onMoveClip; nothing to commit on up (controls re-enabled above)
|
|
3217
|
-
if (p.frameDrag) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; return; } // local-frame origin/rotation is applied live during onMoveFrame; session-only, nothing to commit — clear the snap marker/readout
|
|
3273
|
+
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)
|
|
3218
3274
|
if (p.epDrag) { // end-node drag → write just that endpoint's wp; a click (no drag) just selects the member
|
|
3219
3275
|
if (wasDragging && p.newPt && api && api.onMoveEndpoint) { if (api.onSelect) api.onSelect(p.id, false); api.onMoveEndpoint(p.id, p.end, planPointToWp(p.newPt, p.ppf)); }
|
|
3220
3276
|
else if (api && api.onSelect) api.onSelect(p.id, false);
|
|
@@ -3357,6 +3413,10 @@ function onHoverMove(e) {
|
|
|
3357
3413
|
canvasEl.style.cursor = fh ? 'grab' : 'crosshair';
|
|
3358
3414
|
return;
|
|
3359
3415
|
}
|
|
3416
|
+
if (frame3d && !frameMode && !geoMode() && !cmActive() && !addActive() && !dimMode3d && !clipMode && !wpMode && !basePickCol && !insertMode && !selectedClipIds.size) { // hovering the PASSIVE gizmo (nothing armed) → pointer cursor hints "click to edit the local axes again"
|
|
3417
|
+
let fh = null; try { fh = pickFrameHandle(lastHoverXY[0], lastHoverXY[1], true); } catch { fh = null; }
|
|
3418
|
+
if (fh) { canvasEl.style.cursor = 'pointer'; return; }
|
|
3419
|
+
}
|
|
3360
3420
|
if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(lastHoverXY[0], lastHoverXY[1]); } catch { ch = null; } if (ch) { canvasEl.style.cursor = 'move'; return; } } // over a clip handle → move cursor
|
|
3361
3421
|
let ep = null; try { ep = pickEndpoint(lastHoverXY[0], lastHoverXY[1]); } catch { ep = null; }
|
|
3362
3422
|
if (ep) { // over an end node → ring + move cursor; keep its member's dots shown
|
|
@@ -3380,7 +3440,7 @@ function updateStatusChip() {
|
|
|
3380
3440
|
if (wpMode === 'face') txt = 'Click a member face — the working plane lands on it · Esc to cancel';
|
|
3381
3441
|
else if (wpMode === '3pt') txt = ['Click the plane origin (snapped) · Esc to cancel', 'Click the local-X direction point · Esc to cancel', 'Click a point on the plane’s Y side · Esc to cancel'][(wpDraft || []).length] || '';
|
|
3382
3442
|
else if (addActive()) txt = drDraft ? 'Click the member end · Shift straight · Esc drops the start' : 'Draw a member on the working plane — click the start point · Esc exits';
|
|
3383
|
-
else if (cmActive()) { const st = cmActive(),
|
|
3443
|
+
else if (cmActive()) { const st = cmActive(), _lk = ['u', 'v', 'n'].filter((a) => tfLock.has(a)), lock = _lk.length ? ' · ' + _lk.map((a) => (a === 'u' ? 'X' : a === 'v' ? 'Y' : 'Z')).join(', ') + ' locked' : '';
|
|
3384
3444
|
txt = (!tfDraft ? ((st.tool === 'move' ? 'Move' : (st.array ? 'Copy array' : 'Copy')) + ' — click the base point on the working plane · type after the pick for an exact value')
|
|
3385
3445
|
: (st.array && !tfDraft.vA ? 'Click the direction-A point — or type its spacing' : st.array ? 'Click the direction-B point — the grid previews live' : 'Click the destination — X/Y lock to the plane axes · Esc cancels')) + lock; }
|
|
3386
3446
|
else if (clipMode === 'plane') txt = 'Click a face to set a clip plane · Esc to cancel';
|
|
@@ -3454,6 +3514,7 @@ function dispose() {
|
|
|
3454
3514
|
gridTexCache.clear();
|
|
3455
3515
|
clearRoot();
|
|
3456
3516
|
if (workAreaHelper) { if (overlayScene) overlayScene.remove(workAreaHelper); workAreaHelper.geometry.dispose(); workAreaHelper.material.dispose(); workAreaHelper = null; }
|
|
3517
|
+
if (wpGroup) { if (scene) scene.remove(wpGroup); wpGroup.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); wpGroup = null; } // the reference plane can exist by default now → dispose it too (code-review)
|
|
3457
3518
|
clearConnEnvelope(); clearClipGizmo(); setClipPreview(null); disposeFramePreview(); disposeFrameGizmo(); overlayScene = null; // dispose the frame gizmo/preview THREE resources before dropping the scene (Codex)
|
|
3458
3519
|
clips = []; workArea = null; clipMode = null; selectedClipIds.clear(); clipBoxDraft = null; // clips live on the renderer; drop them with the renderer
|
|
3459
3520
|
if (renderer) renderer.dispose();
|
|
@@ -3483,6 +3544,7 @@ function debug() {
|
|
|
3483
3544
|
near: camera?.near, far: camera?.far,
|
|
3484
3545
|
clips: getClips(), clipPlaneCount: renderer && renderer.clippingPlanes ? renderer.clippingPlanes.length : 0, clipMode, workArea: workAreaState(), selectedClips: [...selectedClipIds],
|
|
3485
3546
|
workPlane: workPlaneInfo(), tfHasBase: !!tfDraft, tfGhosts: tfGhost ? tfGhost.children.length : 0, drHasStart: !!drDraft,
|
|
3547
|
+
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
|
|
3486
3548
|
};
|
|
3487
3549
|
}
|
|
3488
3550
|
// test helper: the current material colour + emissive of a member (verifies deselect restores colour)
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
.detrow{display:flex;gap:6px;margin:2px 0}
|
|
32
32
|
.detf{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;font-size:11px;color:var(--mut)}
|
|
33
33
|
.detf input{width:100%}
|
|
34
|
+
/* F14 definition-points: local-frame coord row — reuses the #csStat.local cyan wash (no new colour) */
|
|
35
|
+
.dp-local{background:rgba(34,211,238,.06);border:1px solid rgba(34,211,238,.35);border-radius:6px;padding:4px 4px 2px}
|
|
36
|
+
.dp-local .detf span{color:#22d3ee}
|
|
34
37
|
#detOpacity{accent-color:var(--brand);flex:1;min-width:0}
|
|
35
38
|
#zoombar #zPct{min-width:40px;text-align:right;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
36
39
|
/* Connection Component breadcrumb (Slice A) — a floating chip over the 3D canvas, same recipe as #zoombar. */
|
|
@@ -40,7 +43,12 @@
|
|
|
40
43
|
#connCrumb .seg.cur{color:var(--brand);font-weight:600;cursor:default;text-decoration:none}
|
|
41
44
|
#connCrumb .sep{color:var(--mut);opacity:.7;padding:0 2px}
|
|
42
45
|
.pilllink{background:none;border:0;color:var(--brand);cursor:pointer;font:inherit;padding:0;text-decoration:underline}
|
|
43
|
-
aside{width:240px;flex:none;background:var(--panel);border-left:1px solid var(--line);padding:12px;overflow:auto}
|
|
46
|
+
aside{width:var(--panelw,240px);flex:none;background:var(--panel);border-left:1px solid var(--line);padding:12px;overflow:auto}
|
|
47
|
+
/* draggable width handle on the panel's left edge (persisted) */
|
|
48
|
+
#panelResizer{flex:none;width:7px;margin-right:-1px;cursor:col-resize;background:transparent;position:relative;z-index:6;touch-action:none;align-self:stretch}
|
|
49
|
+
#panelResizer::before{content:"";position:absolute;inset:0 3px;border-radius:2px;transition:background-color .12s}
|
|
50
|
+
#panelResizer:hover::before,#panelResizer.drag::before{background:var(--brand)}
|
|
51
|
+
#panelResizer:focus-visible{outline:none} #panelResizer:focus-visible::before{background:var(--brand)}
|
|
44
52
|
aside h3{margin:0 0 8px;font-size:12px;color:var(--mut);text-transform:uppercase;letter-spacing:.05em}
|
|
45
53
|
select,input{background:#0f172a;color:var(--text);border:1px solid #475569;border-radius:6px;padding:6px;width:100%;font:13px system-ui}
|
|
46
54
|
.row{margin:8px 0} .danger{background:#7f1d1d;border-color:#991b1b} .danger:hover{background:#991b1b}
|
|
@@ -239,6 +247,11 @@
|
|
|
239
247
|
#snapBar button.on{background:var(--brand);color:#0f172a;opacity:1}
|
|
240
248
|
#snapBar button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
|
|
241
249
|
body.v3d #snapBar [data-snap=perp],body.v3d #snapBar [data-snap=par],body.v3d #snapSect [data-snap=perp],body.v3d #snapSect [data-snap=par]{display:none} /* ⟂/∥ are 2D-only for now (no 3D snap candidates) — hide in 3D, mirroring the insWrap 2D/3D-scoped idiom */
|
|
250
|
+
/* The "3D" snap-MODE toggle is the inverse: 3D-only. A short text label (not an osnap glyph) → smaller/bolder; a hair-line divider before it marks it as a mode, not a peer snap type. */
|
|
251
|
+
#snapBar [data-snap3d]{display:none;font-size:11px;font-weight:700;letter-spacing:.02em;margin-left:4px;border-left:1px solid var(--line);border-radius:0 5px 5px 0;padding-left:4px;box-sizing:border-box;width:32px}
|
|
252
|
+
body.v3d #snapBar [data-snap3d]{display:grid}
|
|
253
|
+
#snapSect [data-snap3d]{display:none}
|
|
254
|
+
body.v3d #snapSect [data-snap3d]{display:flex}
|
|
242
255
|
#moreMenu .mhint{color:var(--mut);font-size:11px;line-height:1.4;padding:4px 12px 6px;max-width:230px;white-space:normal}
|
|
243
256
|
#rfiStat{cursor:pointer;text-decoration:underline dotted} #rfiStat:hover b{color:#fff}
|
|
244
257
|
#confStat{cursor:pointer;text-decoration:underline dotted} #confStat:hover b{filter:brightness(1.25)}
|
|
@@ -750,6 +763,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
750
763
|
<button class="msnap" data-snap=perp role=menuitemcheckbox aria-checked=false data-tip="Perpendicular — from your first point, snap the second square (90°) to a target line (member, grid, or drawing linework). With Extension on, the foot may land on the line’s extension."><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>⟂</span>Perpendicular</button>
|
|
751
764
|
<button class="msnap" data-snap=par role=menuitemcheckbox aria-checked=false data-tip="Parallel — when you draw roughly parallel to a nearby line, snap the direction to exactly parallel."><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>∥</span>Parallel</button>
|
|
752
765
|
<button class="msnap" data-snap=ext role=menuitemcheckbox aria-checked=false data-tip="Snap along the invisible extension of a member/line past its endpoint, with a dashed guide line"><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>┈</span>Extension</button>
|
|
766
|
+
<button class="msnap on" data-snap3d role=menuitemcheckbox aria-checked=true data-tip="On: snap freely to any point in 3D, at any elevation. Off: snap only on the current working level. (3D view only.)"><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>◈</span>3D snapping</button>
|
|
753
767
|
<div class=mhint>Right-click the canvas any time to force one snap type for a single pick.</div>
|
|
754
768
|
</div>
|
|
755
769
|
<button class=msec-hdr data-sec=display aria-expanded=false data-tip="Show/hide plan layers, and edit grid lines">Display<span class=chev aria-hidden=true>▸</span></button>
|
|
@@ -921,10 +935,12 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
921
935
|
<button data-snap=perp data-tip="Perpendicular snap — square (90°) to a target line from your first point">⟂</button>
|
|
922
936
|
<button data-snap=par data-tip="Parallel snap — run parallel to a nearby line">∥</button>
|
|
923
937
|
<button data-snap=ext data-tip="Extension snap">┈</button>
|
|
938
|
+
<button data-snap3d aria-label="3D snapping" data-tip="3D snapping — on: snap freely to any point in 3D, at any elevation; off: snap only on the current working level.">3D</button>
|
|
924
939
|
</div>
|
|
925
940
|
</div>
|
|
926
941
|
<div id=selFly role=menu aria-label="Selectable types"></div>
|
|
927
942
|
</div>
|
|
943
|
+
<div id=panelResizer role=separator aria-orientation=vertical aria-label="Resize properties panel" tabindex=0 data-tip="Drag to resize · double-click to reset"></div>
|
|
928
944
|
<aside id=panel></aside>
|
|
929
945
|
</main>
|
|
930
946
|
<datalist id=conntypes><option>moment</option><option>drag</option><option>shear</option><option>braced</option><option>pinned</option><option>fixed</option></datalist>
|
|
@@ -2373,7 +2389,7 @@ function panel(){
|
|
|
2373
2389
|
<div class=hint id=cmHint style="margin-top:8px">${esc(cmHintText())}</div>
|
|
2374
2390
|
${cmTool==='copy'&&!cmArrayMode?`<div class=sect style="margin-top:12px">Copies</div><input id=cmN inputmode=numeric value="${cmCount}" autocomplete=off><div class=hint style="margin-top:4px">×N places a row — each copy one step further along the pick (linear).</div>`:''}
|
|
2375
2391
|
${cmArrayMode?`<div class=sect style="margin-top:12px">Array counts</div><div class=elab>Direction A</div><input id=cmNA inputmode=numeric value="${cmCountA}" autocomplete=off><div class=elab>Direction B</div><input id=cmNB inputmode=numeric value="${cmCountB}" autocomplete=off><div class=hint id=cmCapHint style="margin-top:4px">Counts include the original — 4 × 6 fills a 4-by-6 grid (max 100).</div>`:''}
|
|
2376
|
-
<div class=hint style="margin-top:8px">${nsel} member${nsel===1?'':'s'} selected. <b>Shift</b>=straight · <b>X/Y/F</b> axis · <b>Alt</b>=no snap · type after the first pick for an exact value · <b>Esc</b> cancels. Connections don't copy.</div>`;
|
|
2392
|
+
<div class=hint style="margin-top:8px">${nsel} member${nsel===1?'':'s'} selected. ${view3d?'<b>Shift</b>=straight · <b>X/Y/Z</b> lock (press again to release · <b>F</b> clears; lock two to snap to whichever you drag toward) · <b>Alt</b>=lock out-of-plane':'<b>Shift</b>=straight · <b>X/Y/F</b> axis · <b>Alt</b>=no snap'} · type after the first pick for an exact value · <b>Esc</b> cancels. Connections don't copy.</div>`;
|
|
2377
2393
|
const wireN=(id,set)=>{const i=document.getElementById(id);if(i)i.onchange=e=>{const n=Math.max(1,Math.min(99,Math.round(Number(e.target.value)||1)));set(n);e.target.value=n;
|
|
2378
2394
|
const ch=document.getElementById('cmCapHint');if(ch)ch.style.color=(cmArrayMode&&cmCountA*cmCountB>100)?'#fca5a5':'';cmRefreshPrev();};};
|
|
2379
2395
|
wireN('cmN',n=>cmCount=n);wireN('cmNA',n=>cmCountA=n);wireN('cmNB',n=>cmCountB=n);
|
|
@@ -2746,6 +2762,52 @@ function panel(){
|
|
|
2746
2762
|
<div class=row><button class=ghostw id=brSwap data-tip="Flip which end is the lower (double-arrow) end — display only, no geometry change">⇄ Swap lower ↔ higher end</button>
|
|
2747
2763
|
<div class=hint style="margin:4px 0 0">Changes which end shows the double arrowhead. <b>Display only</b> — no geometry moves.</div></div>
|
|
2748
2764
|
<div class=hint style="margin:8px 0 0">Split / Extend / Trim don't apply to a brace — drag an end handle to move a work point, or set the Offset above.</div>`;
|
|
2765
|
+
// --- Definition points (F14): the member's start/end work points in GLOBAL + current-view LOCAL coords,
|
|
2766
|
+
// editable. Global (ft-in): x=wpx·12/ppf, y=−wpy·12/ppf (Y-flip to world), z=this end's elevation (in).
|
|
2767
|
+
// LOCAL = relative to the active frame — 3D→frame3d (Steel3DView.frameInfo, mm), 2D→P.frame (planar, plan-px);
|
|
2768
|
+
// same view-scoped resolution updCS() uses. Typing a value moves that endpoint through the same edit() path as
|
|
2769
|
+
// every geometry pill (undo + 2D + 3D + autosave). Inline w2l/l2w mirror steel-3d-core (this script isn't a module).
|
|
2770
|
+
const _dpPpf=(P&&P.pt_per_ft>0)?P.pt_per_ft:1;
|
|
2771
|
+
const _dpFI=(view3d&&window.Steel3DView&&window.Steel3DView.frameInfo)?window.Steel3DView.frameInfo():null;
|
|
2772
|
+
const _dp3d=!!(_dpFI&&_dpFI.mode==='local'); // a 3D UCS (frame3d) is set
|
|
2773
|
+
const _dp2d=!!(!view3d&&P&&P.frame); // 2D local axes (P.frame) set
|
|
2774
|
+
const _dpLocal=_dp3d||_dp2d;
|
|
2775
|
+
// A column is plumb: its two definition points share the plan point (wp[0]) and differ only in elevation —
|
|
2776
|
+
// Bottom = BOS, Top = TOS (respecting the "follow default" flag). A beam's two ends can differ in all of X/Y/Z.
|
|
2777
|
+
const _dpColZ=i=>i===0?(Number.isFinite(+m.col.bos)?+m.col.bos:0):(m.col.tosDef!==false?defaultTOS:(Number.isFinite(+m.col.tos)?+m.col.tos:defaultTOS));
|
|
2778
|
+
const _dpZin=i=>col?_dpColZ(i):effEndTos(m.ends[i]);
|
|
2779
|
+
const _dpGlobal=i=>{const p=col?m.wp[0]:m.wp[i];return [p[0]*12/_dpPpf,-p[1]*12/_dpPpf,_dpZin(i)];}; // point i → world, inches (a column's Bottom/Top share wp[0])
|
|
2780
|
+
const _dpToLocal=g=>{ // world-in [x,y,z] → local-in, or null
|
|
2781
|
+
if(_dp3d){const o=_dpFI.origin,X=_dpFI.xAxis,Y=_dpFI.yAxis,Z=_dpFI.normal,d=[g[0]*25.4-o[0],g[1]*25.4-o[1],g[2]*25.4-o[2]];
|
|
2782
|
+
return [(d[0]*X[0]+d[1]*X[1]+d[2]*X[2])/25.4,(d[0]*Y[0]+d[1]*Y[1]+d[2]*Y[2])/25.4,(d[0]*Z[0]+d[1]*Z[1]+d[2]*Z[2])/25.4];}
|
|
2783
|
+
if(_dp2d){const o=P.frame.o,u=P.frame.u,px=g[0]*_dpPpf/12,py=-g[1]*_dpPpf/12,dx=px-o[0],dy=py-o[1];
|
|
2784
|
+
return [(dx*u[0]+dy*u[1])*12/_dpPpf,(dx*u[1]-dy*u[0])*12/_dpPpf,g[2]];} // v=[uy,−ux]; Z′=global Z (planar frame)
|
|
2785
|
+
return null;};
|
|
2786
|
+
const _dpFromLocal=l=>{ // local-in [x,y,z] → world-in, or null
|
|
2787
|
+
if(_dp3d){const o=_dpFI.origin,X=_dpFI.xAxis,Y=_dpFI.yAxis,Z=_dpFI.normal,L=[l[0]*25.4,l[1]*25.4,l[2]*25.4];
|
|
2788
|
+
return [(o[0]+L[0]*X[0]+L[1]*Y[0]+L[2]*Z[0])/25.4,(o[1]+L[0]*X[1]+L[1]*Y[1]+L[2]*Z[1])/25.4,(o[2]+L[0]*X[2]+L[1]*Y[2]+L[2]*Z[2])/25.4];}
|
|
2789
|
+
if(_dp2d){const o=P.frame.o,u=P.frame.u,du=l[0]*_dpPpf/12,dv=l[1]*_dpPpf/12,px=o[0]+du*u[0]+dv*u[1],py=o[1]+du*u[1]-dv*u[0];
|
|
2790
|
+
return [px*12/_dpPpf,-py*12/_dpPpf,l[2]];}
|
|
2791
|
+
return null;};
|
|
2792
|
+
// Commit a new world-in point Pt=[x,y,z] to point i. A column stays plumb — X/Y write BOTH wp; Z writes this
|
|
2793
|
+
// point's elevation (Bottom→col.bos, Top→col.tos). Touch the elevation ONLY when world Z actually changed, so a
|
|
2794
|
+
// plain X/Y move keeps a default-following Top on the sheet default (a tilted-frame local edit that really moves
|
|
2795
|
+
// Z still clears it). Same per-end TOS rule for a beam.
|
|
2796
|
+
const _dpCommit=(i,Pt)=>edit(()=>{const nx=Pt[0]*_dpPpf/12,ny=-Pt[1]*_dpPpf/12,zChg=Math.abs(Pt[2]-_dpZin(i))>1e-6;
|
|
2797
|
+
if(col){m.wp[0]=[nx,ny];m.wp[1]=[nx,ny];
|
|
2798
|
+
if(zChg){if(i===0)m.col.bos=Pt[2];else{m.col.tos=Pt[2];m.col.tosDef=false;}}}
|
|
2799
|
+
else{m.wp[i]=[nx,ny];if(zChg){m.ends[i].tos=Pt[2];m.ends[i].tosDef=false;}}});
|
|
2800
|
+
const _dpAxes=['X','Y','Z'];
|
|
2801
|
+
const _dpPH='5 3/4" · 1'-0 1/4"';
|
|
2802
|
+
const _dpIn=(id,lbl,vin)=>{const v=Math.abs(vin)<1e-6?0:vin;return `<label class=detf><span>${lbl}</span><input id=${id} inputmode=decimal placeholder="${_dpPH}" value="${esc(fmtFtIn(v))}" autocomplete=off></label>`;}; // snap float-noise to 0 (no "-0"" from a local round-trip)
|
|
2803
|
+
const _dpBlock=(i,head)=>{const g=_dpGlobal(i),loc=_dpLocal?_dpToLocal(g):null;
|
|
2804
|
+
const grow=`<div class=detrow>${_dpAxes.map((ax,a)=>_dpIn('dpG_'+i+'_'+a,ax,g[a])).join('')}</div>`;
|
|
2805
|
+
const lrow=loc?`<div class=elab style="color:#22d3ee;margin:4px 0 0">Local frame</div><div class="detrow dp-local">${_dpAxes.map((ax,a)=>_dpIn('dpL_'+i+'_'+a,ax+'′',loc[a])).join('')}</div>`:'';
|
|
2806
|
+
return head+(loc?'<div class=elab style="margin:2px 0 0">Global</div>':'')+grow+lrow;};
|
|
2807
|
+
const defPts=`<div class=divrow><hr><span class=sect style="margin:0" data-tip="The member's two work points in global coordinates${_dpLocal?' and the current local frame':''}. Type a value to move that point.">Definition points</span><hr></div>`
|
|
2808
|
+
+(col
|
|
2809
|
+
? `<div class=hint style="margin:0 0 4px">A column is plumb — Bottom & Top share the plan X/Y (edit either); Z is the base / top-of-steel elevation.</div>`+_dpBlock(0,`<div class=sect>${dotS}Bottom</div>`)+`<div class=divrow><hr></div>`+_dpBlock(1,`<div class=sect>${dotE}Top</div>`)
|
|
2810
|
+
: _dpBlock(0,`<div class=sect>${dotS}Start</div>`)+`<div class=divrow><hr></div>`+_dpBlock(1,`<div class=sect>${dotE}End</div>`));
|
|
2749
2811
|
p.innerHTML=`<h3>Member ${esc(m.id)}</h3>
|
|
2750
2812
|
${typeFilterHTML()}
|
|
2751
2813
|
${memberTypeField('mTypeS',[m])}
|
|
@@ -2755,6 +2817,7 @@ function panel(){
|
|
|
2755
2817
|
<div class=row><button class=ghostw id=verifyBtn${m.verified?' style="border-color:#166534;color:#86efac"':''} data-tip="Mark this member human-confirmed → 100% in the confidence report">${m.verified?'✓ Verified — human-confirmed':'Mark verified'}</button></div>
|
|
2756
2818
|
${mfSug.length?`<div class="row" style="border:1px solid #a855f7;border-radius:6px;padding:7px 8px;background:rgba(168,85,247,.07)"><div class=elab style="color:#c4b5fd;margin:0">Moment-frame girder · ${_lvl==='roof'?'roof':'2nd floor'} (from Frames)</div><div style="display:flex;flex-wrap:wrap;gap:5px;margin-top:5px">${mfSug.map(s=>`<button class="ghost mfsug${s===m.profile?' on':''}" data-s="${esc(s)}">${esc(s)}</button>`).join('')}</div></div>`:''}
|
|
2757
2819
|
${elev}
|
|
2820
|
+
${defPts}
|
|
2758
2821
|
${bpSect}${spSect}${copeSect}
|
|
2759
2822
|
${col?'':`<div class=divrow><hr><span class=sect style="margin:0" data-tip="Where the section sits on the reference line (between the end dots). Top = top-of-steel (dots on the top flange); Middle = centroid; Bottom = underside.">Profile Position <span style="opacity:.45;font-weight:400">ⓘ</span></span><hr></div>
|
|
2760
2823
|
<div class=seg2 style="margin-top:0"><button id=posTop class="${pos==='top'?'on':''}">Top</button><button id=posMid class="${pos==='middle'?'on':''}">Middle</button><button id=posBot class="${pos==='bottom'?'on':''}">Bottom</button></div>`}
|
|
@@ -2852,6 +2915,20 @@ function panel(){
|
|
|
2852
2915
|
{const ck=document.getElementById('spck_e'+e);if(ck)ck.onchange=ev=>edit(()=>{const jj=(C.joints||[]).find(x=>x&&x.id===jid);if(!jj)return;if(!jj.params)jj.params={};jj.params.stiffener=ev.target.checked;jj.source='user';});}
|
|
2853
2916
|
{const rm=document.getElementById('sprm_e'+e);if(rm)rm.onclick=()=>edit(()=>{C.joints=(C.joints||[]).filter(x=>x!==j);});}} // Remove is undoable
|
|
2854
2917
|
}
|
|
2918
|
+
// Definition points (F14) — each coord commits through edit() (undo + 2D + 3D + autosave). Enter = commit(blur),
|
|
2919
|
+
// Escape = revert; a non-parseable value flags the field red and doesn't commit (mirrors the grid panel's wire()).
|
|
2920
|
+
// stopPropagation keeps ft-in keystrokes off the global shortcut/repeat-last handler.
|
|
2921
|
+
{const dpWire=(id,i,a,isLocal)=>{const inp=document.getElementById(id);if(!inp)return;const orig=inp.value;
|
|
2922
|
+
inp.onkeydown=e=>{e.stopPropagation();if(e.key==='Enter'){e.preventDefault();inp.blur();}else if(e.key==='Escape'){e.preventDefault();inp.value=orig;inp.blur();}};
|
|
2923
|
+
inp.onchange=()=>{const vin=parseLen(inp.value);
|
|
2924
|
+
if(vin==null||!Number.isFinite(vin)){inp.style.borderColor='#fca5a5';return;} // bad parse → flag, don't commit
|
|
2925
|
+
inp.style.borderColor='';
|
|
2926
|
+
const g=_dpGlobal(i);let Pt;
|
|
2927
|
+
if(isLocal){const loc=_dpToLocal(g)||[0,0,0];loc[a]=vin;Pt=_dpFromLocal(loc);}
|
|
2928
|
+
else{Pt=g.slice();Pt[a]=vin;}
|
|
2929
|
+
if(Pt)_dpCommit(i,Pt);};};
|
|
2930
|
+
const wireEnd=i=>_dpAxes.forEach((ax,a)=>{dpWire('dpG_'+i+'_'+a,i,a,false);if(_dpLocal)dpWire('dpL_'+i+'_'+a,i,a,true);});
|
|
2931
|
+
wireEnd(0);wireEnd(1);} // both points (beam Start/End, column Bottom/Top)
|
|
2855
2932
|
document.getElementById('del').onclick=()=>edit(()=>{P.members=P.members.filter(x=>x.id!==m.id);selIds.clear();if(selDimIds.size){P.dims=P.dims.filter(d=>!selDimIds.has(d.id));selDimIds.clear();}}); // also drop any dims a mixed marquee selected
|
|
2856
2933
|
{const vb=document.getElementById('verifyBtn');if(vb)vb.onclick=()=>edit(()=>{m.verified=!m.verified;});}
|
|
2857
2934
|
}
|
|
@@ -2875,6 +2952,13 @@ let snapOnly=null; // Tekla-style TRANSIENT override: one snap kind ('end'|'in
|
|
|
2875
2952
|
const SNAP_PREF_KEY='steel:snapPrefs:v1', SNAP_DEFAULTS={end:true,int:true,mid:true,line:true,ext:false,perp:false,par:false};
|
|
2876
2953
|
let snapEnabled=(()=>{try{return Object.assign({},SNAP_DEFAULTS,JSON.parse(localStorage.getItem(SNAP_PREF_KEY)||'{}'));}catch(_){return {...SNAP_DEFAULTS};}})();
|
|
2877
2954
|
function saveSnapPrefs(){try{localStorage.setItem(SNAP_PREF_KEY,JSON.stringify(snapEnabled));}catch(_){}}
|
|
2955
|
+
// The SNAP-bar "3D snapping" MODE — distinct from the running-snap TYPES above (it gates WHERE they may
|
|
2956
|
+
// land, not which are on). ON (default) = snap freely to any point in 3D at any elevation; OFF = constrain
|
|
2957
|
+
// 3D placement snapping (Move/Copy/Add) to the current working plane. 3D-only surface; read live by the 3D
|
|
2958
|
+
// view (api.snap3dFree). Own persistence key so it never mixes into the per-type snapEnabled map.
|
|
2959
|
+
const SNAP3D_KEY='steel:snap3dFree:v1';
|
|
2960
|
+
let snap3dFree=(()=>{try{return localStorage.getItem(SNAP3D_KEY)!=='0';}catch(_){return true;}})(); // default ON; only an explicit '0' is OFF (unset OR a corrupted value falls back to the ON default)
|
|
2961
|
+
function saveSnap3d(){try{localStorage.setItem(SNAP3D_KEY,snap3dFree?'1':'0');}catch(_){}}
|
|
2878
2962
|
// ── Selection filter (Tekla "select switches"): which object CLASSES — and which member types /
|
|
2879
2963
|
// connection kinds — may enter a selection. One persisted source of truth, consulted at every pick
|
|
2880
2964
|
// sink (2D click/marquee/Ctrl+A, 3D pick/box). Default: everything ON, so nothing is filtered out
|
|
@@ -4103,8 +4187,8 @@ addEventListener('keydown',e=>{
|
|
|
4103
4187
|
if(dk==='c'){e.preventDefault();toggleDimChain();return;}} // C — toggle chained (continuous) dimensioning
|
|
4104
4188
|
if(cmTool&&!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const ak=e.key.toLowerCase(); // Move/Copy armed: X/Y/F force the axis, Z (3D only) locks the frame normal, typing opens the exact-value HUD
|
|
4105
4189
|
if(ak==='x'||ak==='y'||ak==='f'||(ak==='z'&&view3d)){e.preventDefault(); // Z is 3D-only (the normal-axis lock); 2D has no Z, and Alt+Z stays Zoom-Selected (never reaches here — this block requires !altKey)
|
|
4106
|
-
if(view3d&&window.Steel3DView&&window.Steel3DView.setCmAxis)window.Steel3DView.setCmAxis(ak);
|
|
4107
|
-
else{
|
|
4190
|
+
if(view3d&&window.Steel3DView&&window.Steel3DView.setCmAxis)window.Steel3DView.setCmAxis(ak,e.shiftKey); // pass live Shift so the immediate 3D preview refresh matches a click (Alt is up here — this block requires it)
|
|
4191
|
+
else{const wa=ak==='f'?'free':ak;cmAxis=(wa!=='free'&&cmAxis===wa)?'free':wa;cmRefreshPrev();}return;} // same axis key again toggles the lock off (F always frees)
|
|
4108
4192
|
const hasBase=cmDraft||(view3d&&window.Steel3DView&&window.Steel3DView.cmHasBase&&window.Steel3DView.cmHasBase());
|
|
4109
4193
|
if(hasBase&&/^[0-9.\-',]$/.test(e.key)){e.preventDefault();cmHudShow(e.key);return;}} // comma included so a leading-comma entry (,Y) can open the HUD
|
|
4110
4194
|
if(view3d&&mode==='add'&&!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&/^[0-9.\-',]$/.test(e.key)){e.preventDefault();cmHudShow(e.key);return;} // 3D Add-member: typing opens the shared point-entry HUD (own branch, OUTSIDE the Move/Copy guard)
|
|
@@ -4153,12 +4237,36 @@ moreMenu.addEventListener('click',e=>{if(e.target.closest('button')&&!e.target.c
|
|
|
4153
4237
|
// call it, so they can't drift. The transient right-click override is separate and never writes here. ---
|
|
4154
4238
|
const snapBar=document.getElementById('snapBar');
|
|
4155
4239
|
function reflectSnapPrefs(){
|
|
4156
|
-
for(const b of moreMenu.querySelectorAll('button.msnap')){const on=snapEnabled[b.dataset.snap]!==false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
4157
|
-
for(const b of snapBar.querySelectorAll('button')){const on=snapEnabled[b.dataset.snap]!==false;b.classList.toggle('on',on);b.setAttribute('aria-pressed',String(on));}}
|
|
4240
|
+
for(const b of moreMenu.querySelectorAll('button.msnap[data-snap]')){const on=snapEnabled[b.dataset.snap]!==false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
4241
|
+
for(const b of snapBar.querySelectorAll('button[data-snap]')){const on=snapEnabled[b.dataset.snap]!==false;b.classList.toggle('on',on);b.setAttribute('aria-pressed',String(on));}}
|
|
4158
4242
|
function toggleSnap(k){snapEnabled[k]=!(snapEnabled[k]!==false);saveSnapPrefs();reflectSnapPrefs();snapClear();} // clear any stale marker so the change shows on the next move
|
|
4159
|
-
for(const b of moreMenu.querySelectorAll('button.msnap'))b.onclick=e=>{e.stopPropagation();toggleSnap(b.dataset.snap);}; // menu switch (keeps the menu open — settings, not a one-shot action)
|
|
4160
|
-
for(const b of snapBar.querySelectorAll('button'))b.onclick=()=>toggleSnap(b.dataset.snap); // quick-bar glyph
|
|
4243
|
+
for(const b of moreMenu.querySelectorAll('button.msnap[data-snap]'))b.onclick=e=>{e.stopPropagation();toggleSnap(b.dataset.snap);}; // menu switch (keeps the menu open — settings, not a one-shot action)
|
|
4244
|
+
for(const b of snapBar.querySelectorAll('button[data-snap]'))b.onclick=()=>toggleSnap(b.dataset.snap); // quick-bar glyph
|
|
4161
4245
|
reflectSnapPrefs();
|
|
4246
|
+
// The 3D-snapping MODE toggle rides both surfaces too (bar button = aria-pressed, ⋯ row = aria-checked),
|
|
4247
|
+
// but writes its own snap3dFree (not the per-type map). 3D-only (CSS-hidden in 2D). No marker to clear —
|
|
4248
|
+
// the next canvas hover re-evaluates candidates against the new mode (the view reads api.snap3dFree live).
|
|
4249
|
+
const snap3dBtns=[...document.querySelectorAll('[data-snap3d]')];
|
|
4250
|
+
function reflectSnap3d(){for(const b of snap3dBtns){b.classList.toggle('on',snap3dFree);b.setAttribute(b.classList.contains('msnap')?'aria-checked':'aria-pressed',String(snap3dFree));}}
|
|
4251
|
+
function toggleSnap3d(){snap3dFree=!snap3dFree;saveSnap3d();reflectSnap3d();}
|
|
4252
|
+
for(const b of snap3dBtns)b.onclick=e=>{e.stopPropagation();toggleSnap3d();};
|
|
4253
|
+
reflectSnap3d();
|
|
4254
|
+
// Property-panel width: draggable handle on its left edge (persisted, clamped so it can't swallow the canvas).
|
|
4255
|
+
(function(){
|
|
4256
|
+
const rz=document.getElementById('panelResizer'); if(!rz)return;
|
|
4257
|
+
const KEY='steel:panelw:v1', MIN=240, root=document.documentElement, pnl=document.getElementById('panel');
|
|
4258
|
+
const maxW=()=>Math.max(MIN,Math.min(680,Math.round(window.innerWidth*0.6)));
|
|
4259
|
+
const curW=()=>{const v=parseFloat(getComputedStyle(root).getPropertyValue('--panelw')); return Number.isFinite(v)?v:pnl.getBoundingClientRect().width;}; // read the source-of-truth var (border-box, == what apply() sets); getComputedStyle(pnl).width is the CONTENT box (25px short → drift)
|
|
4260
|
+
const apply=(w,save)=>{const c=Math.round(Math.max(MIN,Math.min(maxW(),w)));root.style.setProperty('--panelw',c+'px');if(save)localStorage.setItem(KEY,String(c));};
|
|
4261
|
+
const saved=parseFloat(localStorage.getItem(KEY)); if(Number.isFinite(saved))apply(saved,false);
|
|
4262
|
+
let startX=0,startW=0;
|
|
4263
|
+
const onMove=e=>apply(startW+(startX-e.clientX),false); // handle on the panel's LEFT edge → drag left = wider
|
|
4264
|
+
const onUp=()=>{rz.classList.remove('drag');document.body.style.userSelect='';window.removeEventListener('pointermove',onMove);window.removeEventListener('pointerup',onUp);localStorage.setItem(KEY,String(Math.round(curW())));};
|
|
4265
|
+
rz.addEventListener('pointerdown',e=>{e.preventDefault();startX=e.clientX;startW=curW();rz.classList.add('drag');document.body.style.userSelect='none';window.addEventListener('pointermove',onMove);window.addEventListener('pointerup',onUp);});
|
|
4266
|
+
rz.addEventListener('dblclick',()=>{root.style.removeProperty('--panelw');localStorage.removeItem(KEY);}); // reset to the 240px default
|
|
4267
|
+
rz.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();apply(curW()+(e.shiftKey?40:12),true);}else if(e.key==='ArrowRight'){e.preventDefault();apply(curW()-(e.shiftKey?40:12),true);}});
|
|
4268
|
+
window.addEventListener('resize',()=>{if(root.style.getPropertyValue('--panelw'))apply(curW(),false);}); // re-clamp if the viewport shrank
|
|
4269
|
+
})();
|
|
4162
4270
|
// --- Selection-filter toolbar (Select bar): same discipline as the snap bar — selFilter is the one source
|
|
4163
4271
|
// of truth; the 4 class switches + the two type flyouts (Members / Connections) all reflect off it, and every
|
|
4164
4272
|
// toggle persists + re-renders. Tekla-style: a switch gates what future picks CAN select — it does NOT
|
|
@@ -4218,7 +4326,11 @@ document.getElementById('cpLevelB').onclick=()=>openLevelModal('copy');
|
|
|
4218
4326
|
// member Inspector can show a read-only "Cope (auto)" note (a coped beam otherwise looks like an error).
|
|
4219
4327
|
let copesByMember={}, partsById={};
|
|
4220
4328
|
const view3dApi={
|
|
4221
|
-
onFrame3dChange:()=>{updCS();if(typeof csSyncF3d==='function')csSyncF3d();
|
|
4329
|
+
onFrame3dChange:()=>{updCS();if(typeof csSyncF3d==='function')csSyncF3d();
|
|
4330
|
+
// F14: the Definition-points local (X′/Y′/Z′) row reads the 3D frame — refresh the inspector when the
|
|
4331
|
+
// frame changes outside a render() path (notably Reset-to-global, which only fires this callback). Skip
|
|
4332
|
+
// while the frame tool is armed (it owns the panel) and outside 3D / select mode.
|
|
4333
|
+
if(view3d&&mode==='sel'&&!(window.Steel3DView&&window.Steel3DView.frameArmed&&window.Steel3DView.frameArmed()))panel();}, // the 3D local frame moved/armed/reset → resync the Axes chip + the numeric fields
|
|
4222
4334
|
// POST the in-progress contract so the model reflects unsaved edits; throws on a bad contract.
|
|
4223
4335
|
fetchScene:async()=>{const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract:C})});const j=await r.json();if(!j.ok)throw new Error(j.error||'scene render failed');
|
|
4224
4336
|
// The bake reports everything it could NOT emit in `skipped[]`, and we used to discard it entirely — so a
|
|
@@ -4250,7 +4362,9 @@ const view3dApi={
|
|
|
4250
4362
|
if(mode==='add'){mode='sel';setMode();}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // 3D box-select → shared selection
|
|
4251
4363
|
getMembers:()=>P.members, // active-sheet members (wp) for snap geometry (one ppf)
|
|
4252
4364
|
allMembers, // EVERY sheet's members — the 3D box-select tests all visible meshes, not just the active sheet's
|
|
4365
|
+
membersByPlan:()=>((C&&Array.isArray(C.plans))?C.plans:[]).map(p=>({members:p.members||[],ptPerFt:(p.pt_per_ft>0?p.pt_per_ft:1),defaultTosMm:(p.default_tos!=null?p.default_tos:0)*25.4})), // every sheet's members WITH its OWN px→ft scale AND its OWN default T.O.S — 3D snapping targets the whole model (any elevation), each plan resolved exactly like the server bake (contract-to-scene: per-plan pt_per_ft + `default_tos ?? 0`) so candidates land on the rendered steel. Guards a not-yet-loaded contract (C.plans absent) so a hover can't throw out of the pointer handler.
|
|
4253
4366
|
snapEnabled:()=>snapEnabled, // the persistent running-snaps (⋯ menu → Snapping) — 3D honours the same on/off set
|
|
4367
|
+
snap3dFree:()=>snap3dFree, // SNAP-bar "3D snapping" mode — ON: free 3D snap; OFF: 3D placement snap constrained to the working plane
|
|
4254
4368
|
canSelectId:(id)=>selIdOK(id), // Select-filter predicate for the 3D view (e.g. don't draw a whole-connection envelope for a fully-filtered connection)
|
|
4255
4369
|
ptPerFt:()=>(P&&P.pt_per_ft>0?P.pt_per_ft:1),
|
|
4256
4370
|
defaultTosMm:()=>(defaultTOS!=null?defaultTOS*25.4:0), // editor stores default T.O.S in inches
|
package/dist/web/workspaces.js
CHANGED
|
@@ -783,7 +783,7 @@
|
|
|
783
783
|
function kbPending(st) {
|
|
784
784
|
if (st.organize) return { started: true, since: Date.parse(st.organize.startedAt) };
|
|
785
785
|
const q = st.queued[0];
|
|
786
|
-
if (q) return { started: false, since: Date.parse(q.createdAt) };
|
|
786
|
+
if (q) return { started: false, since: Date.parse(q.createdAt), id: q.id }; // id: which queued request Cancel deletes
|
|
787
787
|
return null;
|
|
788
788
|
}
|
|
789
789
|
const kbAgo = (ms) => {
|
|
@@ -862,10 +862,19 @@
|
|
|
862
862
|
: '<span class="kb-ico" aria-hidden="true">◷</span>';
|
|
863
863
|
const lead = pending.started
|
|
864
864
|
? `Organizing…${age ? ` started ${escapeHtml(age)}` : ''}`
|
|
865
|
-
:
|
|
865
|
+
: `Queued for your terminal AI — waiting to start…${age ? ` (${escapeHtml(age)})` : ''}`;
|
|
866
|
+
// A queued organize (not yet started) can be cancelled — at that point there is no organize lock
|
|
867
|
+
// to strand, so this is the immediate, user-initiated escape from a button wedged by an organize
|
|
868
|
+
// no terminal AI drains (the 24h TTL sweep is the automatic backstop). It sits INSIDE the text
|
|
869
|
+
// span, flowing like a trailing word: the rail is too narrow to pin a separate control beside text
|
|
870
|
+
// that may wrap. Never offered once started — a running pass is lifecycle-owned (its finish/fail
|
|
871
|
+
// clears it), and the guarded DELETE route refuses it (409) anyway.
|
|
872
|
+
const cancel = (!pending.started && pending.id)
|
|
873
|
+
? ` <button type="button" class="kb-pending-cancel" data-kb-cancel-organize="${escapeAttr(pending.id)}" data-tip="Cancel — you can queue a new organize anytime">Cancel</button>`
|
|
874
|
+
: '';
|
|
866
875
|
pendingLine = `<div class="${cls}">${ico}<span>${lead}` +
|
|
867
876
|
(stale ? ' <span class="kb-stale">taking longer than expected — check your terminal AI is running.</span>' : '') +
|
|
868
|
-
'</span></div>';
|
|
877
|
+
cancel + '</span></div>';
|
|
869
878
|
}
|
|
870
879
|
|
|
871
880
|
let status;
|
|
@@ -873,7 +882,8 @@
|
|
|
873
882
|
else if (gen) {
|
|
874
883
|
status = `<span class="ok">✓ organized</span> · ${escapeHtml(kbAgo(Date.now() - Date.parse(gen.publishedAt)))}` +
|
|
875
884
|
(st.manifest.lastLintSummary ? ` · ${escapeHtml(st.manifest.lastLintSummary)}` : '');
|
|
876
|
-
} else status =
|
|
885
|
+
} else if (pending) status = ''; // the pending line already narrates it — never invite a press on the (correctly) disabled Organize
|
|
886
|
+
else status = st.sources.length ? 'Not yet organized — press Organize when you’re ready.' : '';
|
|
877
887
|
|
|
878
888
|
// Organize is this panel's ONE persistent primary action — always visible, even at zero sources,
|
|
879
889
|
// because its presence teaches the two-step model (collect, then Organize). When unavailable it
|
|
@@ -1448,6 +1458,37 @@
|
|
|
1448
1458
|
if (current === proj) renderKnowledge();
|
|
1449
1459
|
}
|
|
1450
1460
|
|
|
1461
|
+
// Cancel a QUEUED (not-yet-started) organize via its GUARDED lifecycle route — the immediate,
|
|
1462
|
+
// user-initiated escape from an Organize button wedged by an organize no terminal AI drained (the
|
|
1463
|
+
// server-side 24h TTL sweep is the automatic backstop). The SERVER decides safety atomically: it
|
|
1464
|
+
// refuses (409 already-started) the instant the pass is in flight, so the client can never strand
|
|
1465
|
+
// the organize lock by racing the terminal AI's /start. A module re-entry flag stops a fast
|
|
1466
|
+
// double-click firing a second (404-ing) delete. renderKnowledge() repaints the true state either way.
|
|
1467
|
+
let kbCancelBusy = false;
|
|
1468
|
+
async function kbCancelOrganize(reqId) {
|
|
1469
|
+
const proj = current;
|
|
1470
|
+
if (!proj || !reqId || kbCancelBusy) return;
|
|
1471
|
+
kbCancelBusy = true;
|
|
1472
|
+
try {
|
|
1473
|
+
await api(kbUrl(proj.id, `/requests/${encodeURIComponent(reqId)}`), { method: 'DELETE' });
|
|
1474
|
+
showToast('Organize cancelled — queue a new one anytime', 'ok');
|
|
1475
|
+
track('kb_organize_cancelled', { app: proj.app });
|
|
1476
|
+
} catch (err) {
|
|
1477
|
+
const code = err && err.body && err.body.code;
|
|
1478
|
+
// already-started: the terminal AI won a fair race — not a failure; the repaint shows "Organizing…".
|
|
1479
|
+
// not-found: already gone (drained/cancelled elsewhere) — silent; the repaint shows it's cleared.
|
|
1480
|
+
if (code === 'already-started') showToast('Organize already started — it’ll finish in your terminal', 'warn');
|
|
1481
|
+
else if (code !== 'not-found') showToast('Couldn’t cancel: ' + ((err && err.message) || err), 'warn');
|
|
1482
|
+
} finally {
|
|
1483
|
+
kbCancelBusy = false;
|
|
1484
|
+
// Refresh the footer Requests counter now for immediate feedback. (The guarded DELETE also
|
|
1485
|
+
// broadcasts requests-changed, which loadRequests()es in this tab too — but async; this is the
|
|
1486
|
+
// ahead-of-SSE immediacy call, mirroring kbOrganize/kbAdjustSubmit.)
|
|
1487
|
+
if (bridge.loadRequests) await bridge.loadRequests();
|
|
1488
|
+
if (current === proj) renderKnowledge();
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1451
1492
|
// Live-toggle the Adjust submit from the textarea content (the generated HTML always renders it
|
|
1452
1493
|
// empty+disabled; this reflects what the user has actually typed, between repaints). An IMPERATIVE
|
|
1453
1494
|
// refs-DOM mutation the generated HTML never encodes — so it must NOT kbInvalidateRefs() (that would
|
|
@@ -1604,6 +1645,8 @@
|
|
|
1604
1645
|
if (x) { rowEl.scrollIntoView({ block: 'nearest' }); x.click(); }
|
|
1605
1646
|
return;
|
|
1606
1647
|
}
|
|
1648
|
+
const cancelOrg = e.target.closest('[data-kb-cancel-organize]');
|
|
1649
|
+
if (cancelOrg) { kbCancelOrganize(cancelOrg.getAttribute('data-kb-cancel-organize')); return; }
|
|
1607
1650
|
const org = e.target.closest('#kb-organize');
|
|
1608
1651
|
if (org) { if (org.getAttribute('aria-disabled') !== 'true') kbOrganize(); return; } // aria-disabled still receives clicks
|
|
1609
1652
|
const adjBtn = e.target.closest('#kb-adjust-submit');
|
|
@@ -2318,10 +2361,34 @@
|
|
|
2318
2361
|
doProjectAction(act.dataset.act, menuFor);
|
|
2319
2362
|
});
|
|
2320
2363
|
|
|
2364
|
+
// Ring the card that just changed so the eye lands on it before the background reload repaints —
|
|
2365
|
+
// reuses the existing card-pulse glow. A freshly-duplicated/renamed card is unshifted to the top
|
|
2366
|
+
// (usually already visible), so scrollIntoView is a no-op unless the grid was scrolled. The
|
|
2367
|
+
// animationend handler ends the glow ~0.6s later; if a reconcile repaint (or reduced-motion, where
|
|
2368
|
+
// there is no animation) gets there first, renderLanding's full innerHTML rebuild drops `is-new`
|
|
2369
|
+
// anyway — so nothing sticks either way.
|
|
2370
|
+
function flashCard(id, opts) {
|
|
2371
|
+
const el = $landing.querySelector(`.ws-card[data-open="${escapeAttr(id)}"]`);
|
|
2372
|
+
if (!el) return;
|
|
2373
|
+
if (opts && opts.scroll) el.scrollIntoView({ block: 'nearest' });
|
|
2374
|
+
el.classList.add('is-new');
|
|
2375
|
+
el.addEventListener('animationend', () => el.classList.remove('is-new'), { once: true });
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2321
2378
|
// Shared rename/duplicate/archive — used by both the kebab menu (one project, from the
|
|
2322
2379
|
// landing grid) and the header project-picker's inline row actions below (any project,
|
|
2323
2380
|
// from anywhere). Never switches projects itself — the caller decides navigation.
|
|
2381
|
+
// Each branch updates the local `projects` array from the endpoint's result (unshift a duplicate,
|
|
2382
|
+
// move a rename to the front, filter out an archive — the unshift mirrors createSeeded/
|
|
2383
|
+
// createFromDrawing) and repaints the grid IMMEDIATELY, so the change is on screen WITH the toast
|
|
2384
|
+
// instead of seconds later when loadProjects() re-fetches; the trailing loadProjects() is then just
|
|
2385
|
+
// a background reconcile. projActionBusy blocks a double-submit (e.g. Duplicate twice on a large
|
|
2386
|
+
// project whose copy is still in flight) — a re-entry while one is in flight is toasted, not
|
|
2387
|
+
// silently dropped, so the user knows why the second click did nothing.
|
|
2388
|
+
let projActionBusy = false;
|
|
2324
2389
|
async function doProjectAction(action, id) {
|
|
2390
|
+
if (projActionBusy) { showToast('Hold on — finishing the last action…', 'warn'); return; }
|
|
2391
|
+
projActionBusy = true;
|
|
2325
2392
|
const proj = projects.find((p) => p.id === id);
|
|
2326
2393
|
try {
|
|
2327
2394
|
if (action === 'rename') {
|
|
@@ -2329,16 +2396,30 @@
|
|
|
2329
2396
|
if (!name) return;
|
|
2330
2397
|
const { project } = await api(`/api/projects/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ name }) });
|
|
2331
2398
|
if (current && current.id === id) { current = project; $projName.textContent = project.name; $crumbName.textContent = project.name; }
|
|
2332
|
-
|
|
2399
|
+
// Rename bumps updatedAt server-side and the grid is newest-activity-first, so the reconcile
|
|
2400
|
+
// will move this card to the front regardless. Do that move now (not an in-place swap) so it
|
|
2401
|
+
// happens once, with the flash, rather than as a jump a second later when loadProjects() lands.
|
|
2402
|
+
const i = projects.findIndex((p) => p.id === id);
|
|
2403
|
+
if (i >= 0) projects.splice(i, 1);
|
|
2404
|
+
projects.unshift(project);
|
|
2405
|
+
renderLanding();
|
|
2406
|
+
flashCard(project.id, { scroll: true });
|
|
2407
|
+
showToast(`Renamed to "${project.name}"`, 'ok');
|
|
2333
2408
|
} else if (action === 'duplicate') {
|
|
2334
2409
|
const { project } = await api(`/api/projects/${encodeURIComponent(id)}/duplicate`, { method: 'POST', body: '{}' });
|
|
2410
|
+
projects.unshift(project); // newest → front, matching the server's newest-first list order
|
|
2411
|
+
renderLanding();
|
|
2412
|
+
flashCard(project.id, { scroll: true });
|
|
2335
2413
|
showToast(`Duplicated as "${project.name}"`, 'ok');
|
|
2336
2414
|
} else if (action === 'archive') {
|
|
2337
2415
|
await api(`/api/projects/${encodeURIComponent(id)}/archive`, { method: 'POST', body: '{}' });
|
|
2416
|
+
projects = projects.filter((p) => p.id !== id); // drop the card now, don't wait for the reload
|
|
2417
|
+
renderLanding(); // repaint BEFORE the closeProject early-return so archive-current reveals a fresh (card-gone) grid too
|
|
2338
2418
|
showToast('Archived — recoverable from ~/.floless/projects/.archive', 'ok');
|
|
2339
2419
|
if (current && current.id === id) { closeProject(); return; }
|
|
2340
2420
|
}
|
|
2341
2421
|
} catch (err) { showToast('Action failed: ' + (err && err.message || err), 'warn'); }
|
|
2422
|
+
finally { projActionBusy = false; }
|
|
2342
2423
|
loadProjects();
|
|
2343
2424
|
}
|
|
2344
2425
|
|