@floless/app 0.97.0 → 0.98.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
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.98.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.98.0" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -56428,6 +56428,7 @@ function bakeContractIntoApp(sourcePath, contract) {
|
|
|
56428
56428
|
delete baked.dims3d;
|
|
56429
56429
|
delete baked.detail_placements;
|
|
56430
56430
|
delete baked.prop_labels;
|
|
56431
|
+
delete baked.member_styles;
|
|
56431
56432
|
if (Array.isArray(contract.plans)) {
|
|
56432
56433
|
baked.plans = contract.plans.map((p) => {
|
|
56433
56434
|
if (p && typeof p === "object") {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"palette": { "type": "array", "items": { "type": "string" }, "description": "Default per-index profile colours." },
|
|
14
14
|
"weights": { "type": "object", "additionalProperties": { "type": ["number", "null"] }, "description": "profile -> plf (pounds per linear foot), from the AISC lookup. null for an unresolved profile (e.g. an unsized moment-frame mark) that has no weight yet." },
|
|
15
15
|
"profile_colors": { "type": "object", "additionalProperties": { "type": "string" }, "description": "profile -> #hex user overrides." },
|
|
16
|
+
"member_styles": { "type": "object", "additionalProperties": { "type": "object", "properties": { "weight": { "enum": ["thin", "med", "thick"] }, "dash": { "enum": ["solid", "dashed", "dotted", "dashdot"] } }, "additionalProperties": false }, "description": "Draft-only 2D display state (like prop_labels): member-type -> line {weight,dash}. Model-global. NOT baked into the lock / 3D scene / IFC / BOM." },
|
|
16
17
|
"sheet_previews": { "type": "object", "additionalProperties": { "type": "string" }, "description": "sheet -> base64 JPEG full-sheet preview (title block excluded)." },
|
|
17
18
|
"custom_details": { "type": "object", "additionalProperties": { "type": "string" }, "description": "user-created detail name -> base64 JPEG." },
|
|
18
19
|
"moment_frames": { "type": "array", "description": "Moment-frame schedule from the frame-elevation sheets." },
|
package/dist/web/app.css
CHANGED
|
@@ -3984,7 +3984,7 @@ tr.hist-diff-row[hidden] { display:none; }
|
|
|
3984
3984
|
.kb-g-fit { position: absolute; top: 10px; right: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-muted); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; font: inherit; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
|
|
3985
3985
|
.kb-g-fit:hover { color: var(--text); border-color: var(--accent); }
|
|
3986
3986
|
.kb-g-fit[hidden] { display: none; }
|
|
3987
|
-
.kb-g-edge { stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: 1.5; }
|
|
3987
|
+
.kb-g-edge { stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
|
|
3988
3988
|
.kb-g-node { cursor: pointer; }
|
|
3989
3989
|
.kb-g-hit { fill: transparent; } /* wider click/focus target */
|
|
3990
3990
|
.kb-g-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
|
|
@@ -784,6 +784,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
784
784
|
<button id=gridToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the grid lines in 2D and 3D"><span class=mck aria-hidden=true></span>Grid lines</button>
|
|
785
785
|
<button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show each selected member's length on the canvas"><span class=mck aria-hidden=true></span>Member length</button>
|
|
786
786
|
<button id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide property labels in the 2D plan (the property selection is shared with 3D — this hides them here only)"><span class=mck aria-hidden=true></span>Property labels</button>
|
|
787
|
+
<button id=refToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the traced reference sheet (the PDF/SVG drawing under the model). Hidden, it also stops contributing snap points."><span class=mck aria-hidden=true></span>Reference sheet</button>
|
|
787
788
|
<button id=gridEditB data-tip="Grid lines — a plan reference with structural bay spacings (n*d repeats a bay). Shows in 2D and 3D; drawing and drags snap to its lines and intersections.">Grid lines…</button>
|
|
788
789
|
<button id=dimStyleB data-tip="Dimension style — end marks, label position and label background. Sets the defaults every dimension follows unless you give it its own style.">Dimension style…</button>
|
|
789
790
|
</div>
|
|
@@ -1102,6 +1103,7 @@ async function boot() {
|
|
|
1102
1103
|
// SHAPES-guarded _nominalPlf for a valid AISC designation absent from the contract's weights map.
|
|
1103
1104
|
C.custom_details = C.custom_details || {};
|
|
1104
1105
|
C.profile_colors = C.profile_colors || {};
|
|
1106
|
+
if(!C.member_styles||typeof C.member_styles!=='object'||Array.isArray(C.member_styles))C.member_styles={}; // F5: per member-type 2D line style {weight,dash} — model-global, draft-only (stripped at bake like prop_labels). boot() only object-guards; main() sanitizes the tokens/keys (sanitizeMemberStyles lives in main()'s scope)
|
|
1105
1107
|
if(!Array.isArray(C.member_types))C.member_types=[];
|
|
1106
1108
|
if(!Array.isArray(C.dims3d))C.dims3d=[]; // model-global draft-only 3D dimensions
|
|
1107
1109
|
if(!Array.isArray(C.detail_placements))C.detail_placements=[]; // model-global draft-only placed detail images (Slice 4)
|
|
@@ -1188,12 +1190,14 @@ function showAiUpdateBanner(message) {
|
|
|
1188
1190
|
}
|
|
1189
1191
|
|
|
1190
1192
|
function main() {
|
|
1193
|
+
C.member_styles=sanitizeMemberStyles(C.member_styles); // F5: clamp the loaded contract's line styles to valid tokens + normalised keys (a hand-edited contract isn't schema-validated; the localStorage draft is separately sanitised in restoreSaved())
|
|
1191
1194
|
let P, X0,Y0,X1,Y1, FT, RB64, EXTX, EXTY, profs; // per-plan, set by setPlan()
|
|
1192
1195
|
let mode='sel', drag=null, picking=false, pickKind='profile', pickEnd=null, geoMode=null;
|
|
1193
1196
|
let dimMode=false, dimDraft=null, dimAxis='free', selDimIds=new Set(), dimsVisible=true; // Dimension tool: armed flag, in-progress {a,b,axis}, sticky axis, selected dim ids (multi-select), show/hide
|
|
1194
1197
|
let drawDraft=null; // Add-member tool: the first CLICKED start point (or null) — click-to-start / click-to-finish, mirroring the Dimension tool (no more press-drag)
|
|
1195
1198
|
let calloutsVisible=true; // Workstream B: show/hide the clickable callout bubbles (details + section/elevation/detail-ref) on the plan in select mode
|
|
1196
1199
|
let showSelLen=(()=>{try{return localStorage.getItem('steel:selLen:v1')==='1';}catch(_){return false;}})(); // ⋯ Display → Show member length: paint each selected member's length on the canvas (opt-in, default off)
|
|
1200
|
+
let refSheetOn=(()=>{try{return localStorage.getItem('steel:refSheet:v1')!=='0';}catch(_){return true;}})(); // ⋯ Display → Reference sheet (F13): show/hide the traced PDF/SVG overlay under the model (default ON; only an explicit '0' hides it)
|
|
1197
1201
|
let gridMode=false, gridPick=false, gridLinePick=null; // Grid lines: panel-takeover editing mode + armed pick-origin / single-line clicks
|
|
1198
1202
|
let dimStyleMode=false; // Dimension style: panel-takeover pane for the model-global defaults (⋯ → Display → Dimension style…)
|
|
1199
1203
|
let csaxisMode=false, csDraft=null; // Local coordinate system "set axes" tool: armed flag + in-progress origin [x,y] (null until click 1). P.frame={o,u} holds the committed local frame (null = global).
|
|
@@ -1445,7 +1449,7 @@ const autofillTOS=syncDefaults;
|
|
|
1445
1449
|
// select/delete/undo — a reader-side id-uniqueness hardening. dims3d rides its own persistence.
|
|
1446
1450
|
// dim_style (the model-global dimension-style defaults) rides every entry like details/member_types: one
|
|
1447
1451
|
// chronological stack means an undo simply walks the whole model back, so there is no cross-sheet clobber.
|
|
1448
|
-
function snapshot(){return JSON.stringify({planes:C.plans.map(p=>({sheet:p.sheet,members:p.members,dims:p.dims||[],frame:p.frame||null,grid:p.grid||null})),joints:C.joints||[],clips:(window.Steel3DView&&window.Steel3DView.clipState)?window.Steel3DView.clipState():null,details:(C.detail_placements||[]),member_types:C.member_types||[],dim_style:C.dim_style||null});} // members/dims/frame/grid are all PER-SHEET → captured per sheet so a cross-sheet undo restores each sheet's OWN dims/frame/grid, never the active sheet's over another's. clips/work area are view-state riding the undo stack; details/dim_style = model-global, captured whole.
|
|
1452
|
+
function snapshot(){return JSON.stringify({planes:C.plans.map(p=>({sheet:p.sheet,members:p.members,dims:p.dims||[],frame:p.frame||null,grid:p.grid||null})),joints:C.joints||[],clips:(window.Steel3DView&&window.Steel3DView.clipState)?window.Steel3DView.clipState():null,details:(C.detail_placements||[]),member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{}});} // members/dims/frame/grid are all PER-SHEET → captured per sheet so a cross-sheet undo restores each sheet's OWN dims/frame/grid, never the active sheet's over another's. clips/work area are view-state riding the undo stack; details/dim_style = model-global, captured whole.
|
|
1449
1453
|
// Undo/redo is a SINGLE GLOBAL stack (not per-plane): snapshot() above captures EVERY plane's
|
|
1450
1454
|
// members, so one whole-model stack is coherent — undo restores all planes at once, and a cross-
|
|
1451
1455
|
// sheet edit/delete/to-level round-trips fully. (Earlier this was per-plane — `undo=P.undo` swapped
|
|
@@ -1478,6 +1482,7 @@ function apply(json){const d=JSON.parse(json);
|
|
|
1478
1482
|
if(window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d(); // and the 3D-side draft/ghosts
|
|
1479
1483
|
if(window.Steel3DView&&window.Steel3DView.setClipState&&'clips' in d)window.Steel3DView.setClipState(d.clips); // restore clips + work area alongside the contract
|
|
1480
1484
|
if('member_types' in d)C.member_types=sanitizeMemberTypes(d.member_types);
|
|
1485
|
+
if('member_styles' in d)C.member_styles=(d.member_styles&&typeof d.member_styles==='object'&&!Array.isArray(d.member_styles))?d.member_styles:{}; // F5: model-global per-type line styles ride the undo stack (like dim_style) so a setMemberLineStyle() edit() is undoable
|
|
1481
1486
|
scheduleSave();render();sync3D();}
|
|
1482
1487
|
function doUndo(){if(!undo.length)return;redo.push(snapshotLike());apply(undo.pop());}
|
|
1483
1488
|
function doRedo(){if(!redo.length)return;undo.push(snapshotLike());apply(redo.pop());}
|
|
@@ -1498,7 +1503,7 @@ function setSaved(state,msg){const el=document.getElementById('saveStat');if(!el
|
|
|
1498
1503
|
// since the engine's setClipState does NOT re-sanitise its input), and caps the list at 10.
|
|
1499
1504
|
function sanitizeViews(arr){if(!Array.isArray(arr))return [];const out=[];for(const v of arr){if(!v||typeof v!=='object')continue;const id=(typeof v.id==='string'&&v.id)?v.id:('v'+Math.random().toString(36).slice(2,9));const name=(typeof v.name==='string'&&v.name.trim())?v.name.slice(0,80):'View';out.push({v:1,id,name,order:typeof v.order==='number'?v.order:out.length,camera:(v.camera&&typeof v.camera==='object')?v.camera:null,projection:v.projection==='ortho'?'ortho':'persp',mode:['solid','wire','xray'].includes(v.mode)?v.mode:'solid',clips:(v.clips&&typeof v.clips==='object')?v.clips:null,objects:(v.objects&&typeof v.objects==='object')?v.objects:null});if(out.length>=10)break;}return out;}
|
|
1500
1505
|
function persist(){try{localStorage.setItem(LSKEY,JSON.stringify({sig:dataSig(),ts:Date.now(),active:C.active,
|
|
1501
|
-
custom_details:C.custom_details, profile_colors:C.profile_colors, member_types:C.member_types, target_confidence:C.target_confidence, dims3d:C.dims3d, dim_overlays:C.dim_overlays, dim_style:C.dim_style, prop_labels:C.prop_labels, joints:C.joints, detail_placements:C.detail_placements, views:C.views,
|
|
1506
|
+
custom_details:C.custom_details, profile_colors:C.profile_colors, member_styles:C.member_styles, member_types:C.member_types, target_confidence:C.target_confidence, dims3d:C.dims3d, dim_overlays:C.dim_overlays, dim_style:C.dim_style, prop_labels:C.prop_labels, joints:C.joints, detail_placements:C.detail_placements, views:C.views,
|
|
1502
1507
|
plans:C.plans.map(p=>({sheet:p.sheet,members:p.members,default_tos:p.default_tos,details:p.details,dims:p.dims,frame:p.frame||null,grid:p.grid||null}))}));setSaved('ok');}catch(e){setSaved('err');console.error('local autosave failed',e);}}
|
|
1503
1508
|
// --- server-side draft save: PUT the FULL contract C — this is the copy Approve bakes.
|
|
1504
1509
|
// localStorage (persist) stays the instant per-browser draft cache; this is the durable one.
|
|
@@ -1527,6 +1532,7 @@ function restoreSaved(){try{const raw=localStorage.getItem(LSKEY);if(!raw)return
|
|
|
1527
1532
|
if(d.sig!==dataSig())return false;const by={};(d.plans||[]).forEach(p=>by[p.sheet]=p);
|
|
1528
1533
|
if(d.custom_details)C.custom_details=d.custom_details;
|
|
1529
1534
|
if(d.profile_colors)C.profile_colors=d.profile_colors;
|
|
1535
|
+
if(d.member_styles)C.member_styles=sanitizeMemberStyles(d.member_styles); // F5: restore per-type line styles from the local draft (sanitised — the localStorage draft is unvalidated, unlike the server contract)
|
|
1530
1536
|
if(Array.isArray(d.member_types))C.member_types=sanitizeMemberTypes(d.member_types);
|
|
1531
1537
|
if(d.target_confidence!=null)C.target_confidence=d.target_confidence;
|
|
1532
1538
|
C.plans.forEach(p=>{const s=by[p.sheet];if(s){if(Array.isArray(s.members))p.members=s.members;if(s.default_tos!=null)p.default_tos=s.default_tos;if(Array.isArray(s.details))p.details=s.details;if(Array.isArray(s.dims))p.dims=s.dims;if('frame' in s)p.frame=s.frame||null;if('grid' in s)p.grid=s.grid||null;p.autofilled=true;}});
|
|
@@ -1550,6 +1556,27 @@ function colorFor(p){const k=(p||'').trim().toUpperCase();
|
|
|
1550
1556
|
const ov=C.profile_colors[p]??(Object.entries(C.profile_colors).find(([kk])=>kk.trim().toUpperCase()===k)||[])[1]; // override: exact key, then case-insensitive — mirrors contract-to-scene pickColor so an override resolves identically in 2D + 3D
|
|
1551
1557
|
if(ov)return ov;
|
|
1552
1558
|
const i=colorRank.indexOf(k);return PAL[((i%PAL.length)+PAL.length)%PAL.length];} // i<0 (blank/CUSTOM/unresolved) wraps to PAL[last], matching pickColor so those members agree in 2D + 3D too
|
|
1559
|
+
// F5: per member-type 2D line style. Tokens → px; dashes chosen to avoid the reserved semantic patterns
|
|
1560
|
+
// (RFI 10 6, brace 30 8 6 8, grid 12 4 2 4). med+solid (or absent) = today's default (line.member stroke-width:6).
|
|
1561
|
+
const MS_W={thin:3,med:6,thick:9},MS_D={solid:'',dashed:'14 8',dotted:'2 8',dashdot:'18 7 3 7'};
|
|
1562
|
+
function memberLineStyle(m){const s=C.member_styles&&C.member_styles[memberTypeOf(m)];if(!s||typeof s!=='object')return null; // no style for this category → render() adds no inline attr (byte-identical to today)
|
|
1563
|
+
const w=MS_W[s.weight],d=(s.dash&&s.dash!=='solid')?MS_D[s.dash]:''; // unknown token → default (undefined width / '' dash)
|
|
1564
|
+
return {w:(w&&w!==6)?w:0, d:(d||'')};} // w=0 / d='' mean "default → omit the inline attr"
|
|
1565
|
+
// Set one property of a member-type's line style; prune back to the empty default so an untouched-looking
|
|
1566
|
+
// category leaves no contract entry. edit() → undo + autosave + re-render.
|
|
1567
|
+
function setMemberLineStyle(tk,prop,val){edit(()=>{const cur=(C.member_styles[tk]&&typeof C.member_styles[tk]==='object')?C.member_styles[tk]:{};
|
|
1568
|
+
const next={weight:cur.weight||'med',dash:cur.dash||'solid'};next[prop]=val;
|
|
1569
|
+
if(next.weight==='med'&&next.dash==='solid')delete C.member_styles[tk];else C.member_styles[tk]=next;});}
|
|
1570
|
+
// F5: clamp a restored member_styles map to valid tokens + normalised type keys. The server schema validates
|
|
1571
|
+
// on save, but the localStorage draft (and any hand-edited contract) is unvalidated — this keeps a bogus
|
|
1572
|
+
// token/key from reaching the next save (which would fail validation) and drops all-default entries.
|
|
1573
|
+
function sanitizeMemberStyles(ms){if(!ms||typeof ms!=='object'||Array.isArray(ms))return {};
|
|
1574
|
+
const WOK={thin:1,med:1,thick:1},DOK={solid:1,dashed:1,dotted:1,dashdot:1},out={};
|
|
1575
|
+
const nk=k=>String(k||'').trim().toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-+|-+$/g,'').slice(0,48); // mirrors normMemberTypeKey (a const defined later → inlined so this stays callable at boot-time init)
|
|
1576
|
+
for(const k in ms){const key=nk(k);if(!key)continue;const s=ms[k];if(!s||typeof s!=='object')continue;
|
|
1577
|
+
const w=WOK[s.weight]?s.weight:'med',d=DOK[s.dash]?s.dash:'solid';
|
|
1578
|
+
if(w!=='med'||d!=='solid')out[key]={weight:w,dash:d};}
|
|
1579
|
+
return out;}
|
|
1553
1580
|
function len(a,b){return Math.hypot(a[0]-b[0],a[1]-b[1]);}
|
|
1554
1581
|
// ── Column profile sections ─────────────────────────────────────────────────────────────────────
|
|
1555
1582
|
// A column is drawn on the plan as its profile-SECTION footprint (I/box/channel/angle/tube), not a
|
|
@@ -1609,7 +1636,9 @@ const _polyStr=pts=>pts.map(p=>p[0].toFixed(1)+','+p[1].toFixed(1)).join(' ');
|
|
|
1609
1636
|
// the blurry raster JPEG. Vector PDFs expose filterElsForPlan(); a genuinely scanned sheet (no vectors)
|
|
1610
1637
|
// falls back to the RB64 raster. ponytail: all line d's are merged into ONE <path> so the browser parses
|
|
1611
1638
|
// one node, not thousands — fast to re-render on pan/zoom.
|
|
1639
|
+
function hasOverlay(){return !!(filterElsForPlan()||RB64);} // F13: the active plan carries a reference sheet — vector linework or a scanned raster
|
|
1612
1640
|
function overlaySvg(){
|
|
1641
|
+
if(!refSheetOn)return ''; // F13: reference sheet hidden → draw neither the raster/vector linework NOR the white pdfsheet backdrop
|
|
1613
1642
|
const els=filterElsForPlan();
|
|
1614
1643
|
if(!els)return RB64?`<image href="data:image/jpeg;base64,${RB64}" x="${X0}" y="${Y0}" width="${X1-X0}" height="${Y1-Y0}"/>`:'';
|
|
1615
1644
|
let d='',circ='';
|
|
@@ -2208,7 +2237,10 @@ function render(){
|
|
|
2208
2237
|
if(isBrace(m)){s+=braceSymbol(m,c,g);continue;} // a brace draws as its distinct symbol (dashed=below-floor + hi/lo arrows), not a plain line (B4)
|
|
2209
2238
|
if(m.role==='column'){const pts=columnSectionPoly(m); // a column draws as its profile-section footprint, not a line
|
|
2210
2239
|
if(pts){s+=`<polygon class="member${m.rfi?' rfi':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}" points="${_polyStr(pts)}" fill="${c}" stroke="${c}"${g}/>`;continue;}}
|
|
2211
|
-
|
|
2240
|
+
const ls=memberLineStyle(m); // F5: category line weight/dash. Inline style (NOT a presentation attr) so it beats line.member/.sel CSS width; the glow still cues selection.
|
|
2241
|
+
const _fx=on?`filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c});`:'', _sw=(ls&&ls.w)?`stroke-width:${ls.w}px;`:'', _sd=(ls&&ls.d&&!m.rfi)?`stroke-dasharray:${ls.d};`:''; // RFI keeps its semantic 10 6 dash
|
|
2242
|
+
const _sty=(_fx||_sw||_sd)?` style="${_fx}${_sw}${_sd}"`:'';
|
|
2243
|
+
s+=`<line class="member${m.rfi?' rfi':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}" x1="${m.wp[0][0]}" y1="${m.wp[0][1]}" x2="${m.wp[1][0]}" y2="${m.wp[1][1]}" stroke="${c}"${_sty}/>`;}
|
|
2212
2244
|
{const hsel=sel2d();if(hsel.length>=1){const HR=epR();for(const sm of hsel)for(let i=0;i<2;i++) s+=`<circle class="handle ${i===0?'ep-start':'ep-end'}" data-mid="${sm.id}" data-h="${i}" cx="${sm.wp[i][0]}" cy="${sm.wp[i][1]}" r="${HR}"/>`;}} // end 1 (start) yellow, end 2 (end) magenta · shown for every selected member · radius grows with zoom (epR) so it stays visible against the thick line
|
|
2213
2245
|
if((mode==='add'||(picking&&pickKind==='profile'))&&P.labels) for(const lb of P.labels){const w=Math.max(40,lb.text.length*11);
|
|
2214
2246
|
s+=`<rect class=lblhot data-prof="${esc(lb.text)}" x="${lb.disp[0]-w/2}" y="${lb.disp[1]-10}" width="${w}" height="20" rx="3"><title>${esc(lb.text)}</title></rect>`;}
|
|
@@ -2241,7 +2273,7 @@ function render(){
|
|
|
2241
2273
|
s+=renderPropLabels(); // right-click property-label chips (2D); 3D labels ride the div-overlay pool
|
|
2242
2274
|
s+=renderSelLenLabels(); // on-select member-length chips (2D), gated by the ⋯ Display "Show member length" toggle
|
|
2243
2275
|
if(P.frame)s+=axisGlyphSvg(P.frame.o,P.frame.u,false); // local-axes glyph at the origin (only when a frame is set; removed on reset)
|
|
2244
|
-
svg.innerHTML=s; document.getElementById('profiles').innerHTML=profs.map(p=>`<option value="${esc(p)}">`).join(''); document.getElementById('details').innerHTML=(P.details||[]).map(d=>`<option value="${esc(d.text)}">`).join(''); stats(); panel(); updUR(); updDup(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); updGridToggle(); updLenToggle(); updDimToggle(); updCalloutToggle(); updPlToggle();
|
|
2276
|
+
svg.innerHTML=s; document.getElementById('profiles').innerHTML=profs.map(p=>`<option value="${esc(p)}">`).join(''); document.getElementById('details').innerHTML=(P.details||[]).map(d=>`<option value="${esc(d.text)}">`).join(''); stats(); panel(); updUR(); updDup(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); updGridToggle(); updLenToggle(); updDimToggle(); updCalloutToggle(); updPlToggle(); updRefToggle();
|
|
2245
2277
|
if(selFilterReady)reflectSelFilter(); // keep the Select-bar Members/Connections buttons in sync with the model — a new/removed connection kind (e.g. the first auto-detailed base plate) flips their on/off without a manual toggle. Gated on selFilterReady so it doesn't run until the deferred first reflect has armed it (that reflect needs BASE_MEMBER_TYPES, initialised later in main()).
|
|
2246
2278
|
if(view3d&&window.Steel3DView){window.Steel3DView.setSelection(selIds);updateIsolateBtn();if(selIds.size&&window.Steel3DView.selectedClips&&window.Steel3DView.selectedClips().length)window.Steel3DView.setSelectedClips([]);refreshLegendSel();} // keep the 3D highlight + legend selection in sync; selecting a member clears any clip selection (exclusive)
|
|
2247
2279
|
try{updateConnCrumb();}catch(_){} // Connection Component breadcrumb follows the selection (3D-only; hidden at root)
|
|
@@ -2646,7 +2678,7 @@ function panel(){
|
|
|
2646
2678
|
'<button class="ghostw f" id=applyTos>Reset all ends to default</button></div>';
|
|
2647
2679
|
document.getElementById('defTos').onchange=e=>{defaultTOS=parseLen(e.target.value);P.default_tos=defaultTOS;syncDefaults();scheduleSave();render();};
|
|
2648
2680
|
document.getElementById('applyTos').onclick=()=>edit(()=>{for(const m of P.members){ensureMeta(m);if(m.role==='column'){m.col.tosDef=true;m.col.tos=defaultTOS;}else for(const en of m.ends){en.tosDef=true;en.tos=defaultTOS;}}});
|
|
2649
|
-
document.querySelectorAll('.swc').forEach(c=>c.onchange=e=>{C.profile_colors[c.dataset.prof]=e.target.value;scheduleSave();render();}); // recolour a profile (applies everywhere it's drawn)
|
|
2681
|
+
document.querySelectorAll('.swc').forEach(c=>c.onchange=e=>{C.profile_colors[c.dataset.prof]=e.target.value;scheduleSave();render();sync3D();}); // recolour a profile (applies everywhere it's drawn; sync3D repaints a live 3D scene, no-op in 2D)
|
|
2650
2682
|
const _rc=document.getElementById('resetCols');if(_rc)_rc.onclick=()=>{C.profile_colors={};scheduleSave();render();};
|
|
2651
2683
|
return;}
|
|
2652
2684
|
if(arr.length>1){
|
|
@@ -2846,10 +2878,23 @@ function panel(){
|
|
|
2846
2878
|
+(col
|
|
2847
2879
|
? `<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>`)
|
|
2848
2880
|
: _dpBlock(0,`<div class=sect>${dotS}Start</div>`)+`<div class=divrow><hr></div>`+_dpBlock(1,`<div class=sect>${dotE}End</div>`));
|
|
2881
|
+
// F1 + F5: member appearance — colour (per profile, 2D+3D) + line weight/dash (per member type, 2D-only, line-drawn members only).
|
|
2882
|
+
const _hasProf=!!(m.profile&&String(m.profile).trim());
|
|
2883
|
+
const _tk=memberTypeOf(m),_tlab=memberTypeLabel(_tk),_msc=(C.member_styles&&C.member_styles[_tk])||{};
|
|
2884
|
+
const _wOn=w=>((_msc.weight||'med')===w?' on':''),_dOn=d=>((_msc.dash||'solid')===d?' on':'');
|
|
2885
|
+
const _DGV={solid:'',dashed:'7 4',dotted:'1.5 3',dashdot:'7 3 1.5 3'}; // PREVIEW-only dasharrays — short so the glyph reads distinctly in a 24px line (the actual member patterns are MS_D, too long to preview)
|
|
2886
|
+
const _dGlyph=d=>`<svg width=26 height=8 viewBox="0 0 26 8" aria-hidden=true><line x1=1 y1=4 x2=25 y2=4 stroke=currentColor stroke-width=2 stroke-linecap=round${_DGV[d]?` stroke-dasharray="${_DGV[d]}"`:''}/></svg>`;
|
|
2887
|
+
const _lineCtl=(!col&&!br)?`<div class=elab style="margin:8px 0 0">Line — all ${esc(_tlab)}<span style="opacity:.5;font-weight:400"> · 2D</span></div>
|
|
2888
|
+
<div class=seg2 style="margin-top:4px"><button class="msW${_wOn('thin')}" data-w=thin data-tip="Thin line">Thin</button><button class="msW${_wOn('med')}" data-w=med data-tip="Default weight">Med</button><button class="msW${_wOn('thick')}" data-w=thick data-tip="Thick line">Thick</button></div>
|
|
2889
|
+
<div class="seg2 segico" style="margin-top:6px"><button class="msD${_dOn('solid')}" data-d=solid data-tip="Solid">${_dGlyph('solid')}</button><button class="msD${_dOn('dashed')}" data-d=dashed data-tip="Dashed">${_dGlyph('dashed')}</button><button class="msD${_dOn('dotted')}" data-d=dotted data-tip="Dotted">${_dGlyph('dotted')}</button><button class="msD${_dOn('dashdot')}" data-d=dashdot data-tip="Dash-dot">${_dGlyph('dashdot')}</button></div>`:'';
|
|
2890
|
+
const appearanceSect=(_hasProf||_lineCtl)?`<div class=divrow><hr><span class=sect style="margin:0" data-tip="Colour is per profile — recolours everywhere that profile is drawn, 2D and 3D. Line weight and dash are per member type, 2D only.">Appearance</span><hr></div>`
|
|
2891
|
+
+(_hasProf?`<div style="display:flex;align-items:center;gap:8px;margin-top:2px"><span class=elab style="margin:0;flex:none">Colour</span><input type=color id=msColor class=swc value="${colorFor(m.profile)}" data-tip="Colour for ${esc(m.profile)} — recolours every ${esc(m.profile)} (2D + 3D)"><span class=hint style="margin:0;opacity:.6">${esc(m.profile)} · everywhere</span></div>`:'')
|
|
2892
|
+
+_lineCtl:'';
|
|
2849
2893
|
p.innerHTML=`<h3>Member ${esc(m.id)}</h3>
|
|
2850
2894
|
${typeFilterHTML()}
|
|
2851
2895
|
${memberTypeField('mTypeS',[m])}
|
|
2852
2896
|
<div class="f"><div class=elab>Profile</div><div style="display:flex;gap:6px"><input id=pf class=combo data-src=profiles value="${esc(m.profile)}" style="flex:1" autocomplete=off><button id=pickProf class="ghost${(picking&&pickKind==='profile')?' on':''}" data-tip="Pick profile by clicking a label in the drawing">⌖ pick</button></div>${(picking&&pickKind==='profile')?'<div class="hint" style="margin-top:4px;font-style:italic;color:var(--brand)">Click a profile label in the drawing…</div>':(picking&&pickKind==='detail')?'<div class="hint" style="margin-top:4px;font-style:italic;color:#a855f7">Click a detail callout in the drawing…</div>':''}</div>
|
|
2897
|
+
${appearanceSect}
|
|
2853
2898
|
${braceSect}
|
|
2854
2899
|
<div class="row hint">Length <b>${L} ft</b> · ${wpf==null?'<span id=rfiPill class="pill pill-clickable" role=button tabindex=0 data-tip="Open the RFI list, focused on this member" style="background:#7f1d1d">RFI — size unresolved</span>':'Weight <b>'+(_lenFt(m)*wpf).toFixed(0)+' lb</b> · '+wpf+' lb/ft'}</div>
|
|
2855
2900
|
<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>
|
|
@@ -2872,6 +2917,9 @@ function panel(){
|
|
|
2872
2917
|
{const rp=document.getElementById('rfiPill');if(rp){const go=()=>openRFI(m.id);rp.onclick=go;rp.onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();e.stopPropagation();go();}};}} // F12: the RFI pill opens the list focused on THIS member (role=button span → keydown for Enter/Space). stopPropagation so idle Space/Enter doesn't ALSO hit the global repeat-last handler (:3804) — matches the editor's local-keydown convention (:1738,:4212)
|
|
2873
2918
|
document.getElementById('pickProf').onclick=()=>{if(picking&&pickKind==='profile'){picking=false;}else{picking=true;pickKind='profile';pickEnd=null;}render();};
|
|
2874
2919
|
document.getElementById('mTypeS').onchange=e=>{const v=e.target.value;if(!normMemberTypeKey(v)){e.target.value=memberTypeLabel(memberTypeOf(m));return;}edit(()=>{const k=memberTypeFromInput(v);if(k&&memberTypeOf(m)!==k)applyMemberType([m],k);});}; // retype → role + legend recategorize (edit() → sync3D → build3DLegend); undoable
|
|
2920
|
+
{const _cc=document.getElementById('msColor');if(_cc)_cc.onchange=e=>{C.profile_colors[m.profile]=e.target.value;scheduleSave();render();sync3D();};} // F1: recolour this member's profile (same write as the legend swatch) — sync3D() repaints a live 3D scene (no-op in 2D) so colour is truly 2D+3D
|
|
2921
|
+
document.querySelectorAll('.msW').forEach(b=>b.onclick=()=>setMemberLineStyle(memberTypeOf(m),'weight',b.dataset.w)); // F5: per member-type line weight
|
|
2922
|
+
document.querySelectorAll('.msD').forEach(b=>b.onclick=()=>setMemberLineStyle(memberTypeOf(m),'dash',b.dataset.d)); // F5: per member-type line dash
|
|
2875
2923
|
document.querySelectorAll('.mfsug').forEach(b=>b.onclick=()=>edit(()=>{m.profile=b.dataset.s;m.mf=true;m.rfi=(_wt(m.profile)==null);if(!profs.includes(m.profile)){profs.push(m.profile);profs.sort();}})); // record the moment-frame provenance (drives the confidence "schedule-resolved" factor)
|
|
2876
2924
|
const _gel=document.getElementById('geoEL'),_gsp=document.getElementById('geoSplit');
|
|
2877
2925
|
if(_gel)_gel.onclick=()=>{geoMode=(geoMode==='el'?null:'el');setGeo();render();};
|
|
@@ -3044,6 +3092,7 @@ function _segX(a,b,c,d){const rx=b[0]-a[0],ry=b[1]-a[1],sx=d[0]-c[0],sy=d[1]-c[1
|
|
|
3044
3092
|
// drawing×drawing intersection snap (that O(n²) over ~6k segments is untenable per-move); spatial index if needed.
|
|
3045
3093
|
let _ovSnap=null,_ovSnapEls=null;
|
|
3046
3094
|
function overlaySnapGeom(){
|
|
3095
|
+
if(!refSheetOn){_ovSnap=null;_ovSnapEls=null;return null;} // F13: hidden reference sheet contributes no snap candidates (don't snap to invisible linework — buildSnap :3062 + snapPerpTargets :3085)
|
|
3047
3096
|
const els=filterElsForPlan();
|
|
3048
3097
|
if(!els){_ovSnap=null;_ovSnapEls=null;return null;} // scanned raster / empty → nothing traced to snap to
|
|
3049
3098
|
if(els===_ovSnapEls&&_ovSnap)return _ovSnap; // same sheet's vectors → reuse the parse
|
|
@@ -4154,6 +4203,8 @@ function updCalloutToggle(){const b=document.getElementById('calloutToggleB');if
|
|
|
4154
4203
|
document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();calloutsVisible=!calloutsVisible;updCalloutToggle();render();};
|
|
4155
4204
|
function updPlToggle(){const b=document.getElementById('plToggleB');if(b){const on=!!(C.prop_labels&&C.prop_labels.vis2d);b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}} // B1: 2D property-label visibility (independent of 3D)
|
|
4156
4205
|
document.getElementById('plToggleB').onclick=e=>{e.stopPropagation();C.prop_labels.vis2d=!C.prop_labels.vis2d;updPlToggle();refreshPropLabels();}; // refreshPropLabels → scheduleSave()+render(): repaints the 2D chips (gated by vis2d) and persists the choice
|
|
4206
|
+
function updRefToggle(){const b=document.getElementById('refToggleB');if(!b)return;b.disabled=!hasOverlay();b.classList.toggle('on',refSheetOn);b.setAttribute('aria-checked',String(refSheetOn));} // F13: grey the row out on a plan with no reference sheet (mirrors updGridToggle's no-grid disable)
|
|
4207
|
+
document.getElementById('refToggleB').onclick=e=>{e.stopPropagation();refSheetOn=!refSheetOn;try{localStorage.setItem('steel:refSheet:v1',refSheetOn?'1':'0');}catch(_){}updRefToggle();render();}; // render() rebuilds the SVG (overlaySvg gone/back) and buildSnap re-reads overlaySnapGeom (snap candidates gone/back)
|
|
4157
4208
|
document.getElementById('gridEditB').onclick=()=>{setGridMode(!gridMode);render();};
|
|
4158
4209
|
document.getElementById('dimStyleB').onclick=()=>{setDimStyleMode(!dimStyleMode);render();};
|
|
4159
4210
|
document.getElementById('gridToggleB').onclick=e=>{e.stopPropagation();gridSetVisible(!gridOn());};
|
|
@@ -6583,6 +6634,7 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6583
6634
|
if(typeof C!=='undefined'&&C)C.filter=sflt;_ovSnapEls=null;Object.assign(snapEnabled,se);snapOnly=so;P.members=sm;P.segments=ss;P.dims=sd;dimsVisible=sdv;zoom=sz;}
|
|
6584
6635
|
// 10c) Overlay (traced PDF filter) linework as a ⟂ target (reusing B3 overlaySnapGeom) + els-identity cache rebuild
|
|
6585
6636
|
{if(typeof C!=='undefined'&&C){const sm=P.members,ss=P.segments,sd=P.dims,sdv=dimsVisible,ssh=P.sheet,sz=zoom,se=Object.assign({},snapEnabled),so=snapOnly,sflt=C.filter;
|
|
6637
|
+
const _srs=refSheetOn;refSheetOn=true; // F13: overlay snapping requires the reference sheet shown — force it on for these overlay-snap assertions (a persisted OFF in localStorage would otherwise fail them)
|
|
6586
6638
|
zoom=1;snapOnly=null;P.members=[];P.segments=[];P.dims=[];dimsVisible=false;P.sheet='__perptest'; // isolate: no member/segment/dim geometry → only the overlay is a candidate
|
|
6587
6639
|
snapEnabled.end=false;snapEnabled.int=false;snapEnabled.mid=false;snapEnabled.line=false;snapEnabled.ext=false;snapEnabled.perp=true;snapEnabled.par=false;
|
|
6588
6640
|
C.filter={elements:[{kind:'line',x1:0,y1:100,x2:200,y2:100}]};_ovSnapEls=null;buildSnap(null,{noGrid:true}); // explicit x1 overlay line; NO member/grid → only the overlay can be hit
|
|
@@ -6591,7 +6643,7 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6591
6643
|
const o2=snap(60,97,[60,140]);ok(o2.hit&&o2.kind==='perp'&&pnear([o2.x,o2.y],[60,100]),'⟂ targets OVERLAY d-path linework AND the els-identity cache rebuilt on the swapped array');
|
|
6592
6644
|
snapEnabled.perp=false;snapEnabled.par=true;
|
|
6593
6645
|
const opar=snap(70,102,[10,100]);ok(opar.kind!=='par','∥ does NOT target the overlay — a drag parallel to a traced line does not lock (overlay too dense to direction-match; parallel uses model geometry only)');
|
|
6594
|
-
C.filter=sflt;P.sheet=ssh;P.dims=sd;dimsVisible=sdv;_ovSnapEls=null;Object.assign(snapEnabled,se);snapOnly=so;P.members=sm;P.segments=ss;zoom=sz;}}
|
|
6646
|
+
refSheetOn=_srs;C.filter=sflt;P.sheet=ssh;P.dims=sd;dimsVisible=sdv;_ovSnapEls=null;Object.assign(snapEnabled,se);snapOnly=so;P.members=sm;P.segments=ss;zoom=sz;}}
|
|
6595
6647
|
// 10d) ⟂/∥ can target a DIMENSION line (square/parallel to a placed dimension)
|
|
6596
6648
|
{const sm=P.members,ss=P.segments,sd=P.dims,sdv=dimsVisible,sz=zoom,se=Object.assign({},snapEnabled),so=snapOnly,sflt=(typeof C!=='undefined'&&C)?C.filter:undefined;
|
|
6597
6649
|
if(typeof C!=='undefined'&&C)C.filter=null;_ovSnapEls=null;
|
|
@@ -6603,6 +6655,7 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6603
6655
|
if(typeof C!=='undefined'&&C)C.filter=sflt;_ovSnapEls=null;Object.assign(snapEnabled,se);snapOnly=so;P.members=sm;P.segments=ss;P.dims=sd;dimsVisible=sdv;zoom=sz;}
|
|
6604
6656
|
// 11b) B3 — snapping to the traced PDF overlay (filter vectors → endpoint/nearest/midpoint) + the path parser
|
|
6605
6657
|
{const sm=P.members,ss=P.segments,sd=P.dims,sf=C.filter,ssh=P.sheet,sdv=dimsVisible,sz=zoom;
|
|
6658
|
+
const _srs2=refSheetOn;refSheetOn=true; // F13: force the reference sheet shown for the overlay-snap assertions
|
|
6606
6659
|
zoom=1;P.members=[];P.segments=[];P.dims=[];dimsVisible=false;P.sheet='__ovtest';
|
|
6607
6660
|
C.filter={elements:[{kind:'line',d:'M 0 0 L 100 0 L 100 40'}]}; // an L-polyline (0,0)→(100,0)→(100,40)
|
|
6608
6661
|
_ovSnapEls=null;buildSnap(null,{noGrid:true}); // reset the cache (keys on els identity), then rebuild
|
|
@@ -6610,6 +6663,7 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6610
6663
|
const om=snap(50,2);ok(om.hit&&om.kind==='mid'&&pnear([om.x,om.y],[50,0]),'overlay → snaps to a traced segment midpoint (△)');
|
|
6611
6664
|
const ol=snap(30,3);ok(ol.hit&&pnear([ol.x,ol.y],[30,0]),'overlay → snaps onto a traced line (nearest)');
|
|
6612
6665
|
_ovSnapEls=null;buildSnap(null,{noGrid:true,noOverlay:true});const on=snap(2,2);ok(!on.hit,'opts.noOverlay excludes the overlay from the snap set');
|
|
6666
|
+
refSheetOn=false;_ovSnapEls=null;buildSnap(null,{noGrid:true});ok(!snap(2,2).hit,'F13: a hidden reference sheet (refSheetOn=false) excludes the traced overlay from the snap set');refSheetOn=true;_ovSnapEls=null;buildSnap(null,{noGrid:true});
|
|
6613
6667
|
// parser handles the full line-ish grammar so snapping stays in step with what overlaySvg() draws
|
|
6614
6668
|
{const g=[];parsePathSegs('M 0 0 L 10 0 C 12 5 14 5 16 0',(a,b)=>g.push([a,b]));
|
|
6615
6669
|
ok(g.length===2&&pnear(g[0][0],[0,0])&&pnear(g[0][1],[10,0])&&pnear(g[1][1],[16,0]),'parsePathSegs: M/L segment + C chord to endpoint');}
|
|
@@ -6620,7 +6674,7 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6620
6674
|
P.members=[{id:'col',wp:[[200,0],[200,50]]}];C.filter={elements:[{kind:'line',d:'M 5 30 L 5 60'}]}; // authored column far away; overlay vertices sit at x=5
|
|
6621
6675
|
_ovSnapEls=null;buildSnap(null,{noGrid:true});
|
|
6622
6676
|
const aa=snap(7,500);ok(!aa.hit&&aa.x===7,'axis-align ignores overlay vertices — a free point is NOT silently pulled to a drawing column');
|
|
6623
|
-
C.filter=sf;P.sheet=ssh;_ovSnapEls=null;P.members=sm;P.segments=ss;P.dims=sd;dimsVisible=sdv;zoom=sz;}
|
|
6677
|
+
refSheetOn=_srs2;C.filter=sf;P.sheet=ssh;_ovSnapEls=null;P.members=sm;P.segments=ss;P.dims=sd;dimsVisible=sdv;zoom=sz;}
|
|
6624
6678
|
// 11) member length — true 3D distance between the two end nodes: level beam = plan run, plumb column = TOS−BOS
|
|
6625
6679
|
// height (its plan points coincide → 0 plan distance), and a SLOPED member picks up its elevation rise.
|
|
6626
6680
|
{const sf=FT,st=defaultTOS;FT=12;defaultTOS=198;
|
|
@@ -6692,6 +6746,22 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6692
6746
|
ok(pts.every(p=>p[0]>=-0.01&&p[0]<=100.01),'brace arrowheads never overhang the work points');
|
|
6693
6747
|
ok(braceHeadPoints(m).length===3,'brace draws 3 heads (single higher + double lower)');}
|
|
6694
6748
|
|
|
6749
|
+
// F5: per member-type line-style resolution (tokens → px; default/absent renders as today; RFI keeps its own dash via render()'s !m.rfi gate).
|
|
6750
|
+
{const _sv=C.member_styles,bm={id:'msB',role:'beam',profile:'W16X26',memberType:'beam',wp:[[0,0],[100,0]],ends:[{},{}]};
|
|
6751
|
+
C.member_styles={};ok(memberLineStyle(bm)===null,'memberLineStyle: unstyled category → null (renders byte-identical to today)');
|
|
6752
|
+
C.member_styles={beam:{weight:'thick',dash:'dashed'}};const _r=memberLineStyle(bm);
|
|
6753
|
+
ok(_r&&_r.w===9&&_r.d==='14 8','memberLineStyle maps thick→9px + dashed→"14 8"');
|
|
6754
|
+
C.member_styles={beam:{weight:'med',dash:'solid'}};const _r2=memberLineStyle(bm);
|
|
6755
|
+
ok(_r2&&_r2.w===0&&_r2.d==='','med+solid → default (w=0,d="" so render() omits both inline attrs)');
|
|
6756
|
+
C.member_styles={beam:{weight:'thin',dash:'bogus'}};const _r3=memberLineStyle(bm);
|
|
6757
|
+
ok(_r3&&_r3.w===3&&_r3.d==='','an unknown dash token falls back to solid (no dasharray)');
|
|
6758
|
+
C.member_styles={beam:{weight:'thick',dash:'dashed'}};const _ss=JSON.parse(snapshot());
|
|
6759
|
+
ok(_ss.member_styles&&_ss.member_styles.beam&&_ss.member_styles.beam.weight==='thick','snapshot() captures member_styles → a setMemberLineStyle() edit() is undoable');
|
|
6760
|
+
ok(sanitizeMemberStyles({beam:{weight:'bogus',dash:'dashed'}}).beam.weight==='med','sanitizeMemberStyles clamps a bogus weight token to med (a corrupt draft can never reach the next save)');
|
|
6761
|
+
ok(!('x' in sanitizeMemberStyles({x:{weight:'med',dash:'solid'}})),'sanitizeMemberStyles drops an all-default entry');
|
|
6762
|
+
ok('beam' in sanitizeMemberStyles({Beam:{weight:'thick',dash:'solid'}}),'sanitizeMemberStyles normalises the type key (Beam→beam) so it matches memberTypeOf lookups');
|
|
6763
|
+
C.member_styles=_sv;}
|
|
6764
|
+
|
|
6695
6765
|
// ── the CLIENT MIRRORS of the server guards. These are the paths that actually bite the user while
|
|
6696
6766
|
// editing (silent geometry corruption), and the server tests do not protect them. (pr-test-analyzer)
|
|
6697
6767
|
ok(!_mElig(normBrace(mk({}))),'_mElig rejects a brace (never merges into a beam)');
|
package/dist/web/workspaces.js
CHANGED
|
@@ -962,7 +962,7 @@
|
|
|
962
962
|
const lines = graph.edges.map((e) => { const a = pos[idx.get(e.a)], b = pos[idx.get(e.b)];
|
|
963
963
|
return (a && b) ? `<line class="kb-g-edge" x1="${a.x.toFixed(1)}" y1="${a.y.toFixed(1)}" x2="${b.x.toFixed(1)}" y2="${b.y.toFixed(1)}"/>` : ''; }).join('');
|
|
964
964
|
const dots = graph.nodes.map((n, i) => { const p = pos[i];
|
|
965
|
-
return `<g class="kb-g-node kb-g-${escapeAttr(n.type)}" tabindex="0" role="button" aria-label="${escapeAttr(n.title + ', ' + n.type)}" data-kb-node="${escapeAttr(n.slug)}" data-tip="${escapeAttr(n.title + ' · ' + n.type)}" transform="translate(${p.x.toFixed(1)},${p.y.toFixed(1)})">` +
|
|
965
|
+
return `<g class="kb-g-node kb-g-${escapeAttr(n.type)}" tabindex="0" role="button" aria-label="${escapeAttr(n.title + ', ' + n.type)}" data-kb-node="${escapeAttr(n.slug)}" data-tip="${escapeAttr(n.title + ' · ' + n.type)}" data-pos="${p.x.toFixed(1)},${p.y.toFixed(1)}" transform="translate(${p.x.toFixed(1)},${p.y.toFixed(1)})">` +
|
|
966
966
|
`<circle class="kb-g-hit" r="16"/><circle class="kb-g-dot" r="9"/><text x="13" y="4">${escapeHtml(n.title)}</text></g>`; }).join('');
|
|
967
967
|
const overview = graph.index ? `<button type="button" class="kb-g-overview" data-kb-node="${escapeAttr(graph.index.slug)}" data-tip="Open the overview">✦ Overview</button>` : '';
|
|
968
968
|
const legend = '<div class="kb-g-legend"><span class="kb-gleg src">Source</span><span class="kb-gleg con">Concept</span><span class="kb-gleg per">Person</span></div>';
|
|
@@ -979,6 +979,14 @@
|
|
|
979
979
|
function kbSetVb(svg, x, y, w, h) {
|
|
980
980
|
svg.setAttribute('viewBox', `${x} ${y} ${w} ${h}`);
|
|
981
981
|
const [bx, by, bw] = svg.dataset.vbBase.split(' ').map(Number);
|
|
982
|
+
// Shrinking the viewBox to zoom magnifies everything inside it — dots and labels would balloon and
|
|
983
|
+
// overlap. Counter-scale each node by k = shown-fraction-of-base so its dot + label keep a constant
|
|
984
|
+
// on-screen size (map-label behaviour). scale() is around the group's local origin, where the dot
|
|
985
|
+
// sits, so the dot stays pinned to its graph coord. (Edge stroke stays constant via non-scaling-stroke.)
|
|
986
|
+
const k = w / bw;
|
|
987
|
+
svg.querySelectorAll('.kb-g-node').forEach((n) => {
|
|
988
|
+
if (n.dataset.pos) n.setAttribute('transform', `translate(${n.dataset.pos}) scale(${k})`);
|
|
989
|
+
});
|
|
982
990
|
const off = Math.abs(w - bw) > 0.5 || Math.abs(x - bx) > 0.5 || Math.abs(y - by) > 0.5;
|
|
983
991
|
const fit = svg.parentElement.querySelector('[data-kb-fit]');
|
|
984
992
|
if (fit) fit.hidden = !off;
|