@floless/app 0.99.1 → 0.99.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +2 -2
- package/dist/web/app.css +2 -0
- package/dist/web/steel-editor.html +20 -11
- package/dist/web/workspaces.js +38 -1
- 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.99.
|
|
53109
|
+
define: true ? "0.99.3" : 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.99.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.99.3" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
package/dist/web/app.css
CHANGED
|
@@ -3981,6 +3981,8 @@ tr.hist-diff-row[hidden] { display:none; }
|
|
|
3981
3981
|
.kb-g-hint { font-size: 10.5px; color: var(--text-dim); }
|
|
3982
3982
|
.kb-graph-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; position: relative; }
|
|
3983
3983
|
.kb-graph-svg { width: 100%; height: 100%; }
|
|
3984
|
+
.kb-graph-svg.kb-zoomed { cursor: grab; } /* pannable (zoomed in) — nodes keep their own pointer */
|
|
3985
|
+
.kb-graph-svg.kb-panning, .kb-graph-svg.kb-panning * { cursor: grabbing; } /* while dragging, grabbing everywhere incl. over nodes */
|
|
3984
3986
|
.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
3987
|
.kb-g-fit:hover { color: var(--text); border-color: var(--accent); }
|
|
3986
3988
|
.kb-g-fit[hidden] { display: none; }
|
|
@@ -428,8 +428,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
428
428
|
body.dimon #svg,body.dimon line.member,body.dimon line.seg,body.dimon image,body.add #svg,body.add line.member,body.add line.seg,body.add image,body.add polygon.member,body.add rect.pdfsheet{cursor:crosshair} /* Add-member is click-to-place like the Dimension tool → the whole canvas shows the crosshair */
|
|
429
429
|
body.csaxison #svg,body.csaxison line.member,body.csaxison line.seg,body.csaxison image{cursor:crosshair}
|
|
430
430
|
g.csglyph text{user-select:none}
|
|
431
|
-
body.geo line.seg{opacity:.45;cursor:crosshair} body.geo line.member{cursor:crosshair}
|
|
432
|
-
body.geo line.seg:hover{stroke:#22d3ee;opacity:1;stroke-width:4} body.geo line.member:hover{stroke-width:8}
|
|
431
|
+
body.geo line.seg{opacity:.45;cursor:crosshair} body.geo line.member{cursor:crosshair} body.geoel line.gridhit{cursor:crosshair} /* a grid line is an extend/trim target (geoel) — crosshair only then, not in Split; leaves its drag/resize cursor everywhere else */
|
|
432
|
+
body.geo line.seg:hover{stroke:#22d3ee;opacity:1;stroke-width:4} body.geo line.member:hover{stroke-width:8} body.geoel line.gridhit:hover{stroke:#22d3ee;opacity:.55} /* target cue on the coincident transparent hit line — colour only, KEEP its 9px width (shrinking it would shrink the pointer-events:stroke hit area and flicker the hover) */
|
|
433
433
|
circle.numbg{fill:var(--brand);stroke:#fff;stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none}
|
|
434
434
|
text.numtx{fill:#fff;font:bold 12px system-ui;text-anchor:middle;dominant-baseline:central;pointer-events:none}
|
|
435
435
|
#dupStat.has b{color:#fca5a5} #dupB.alert{background:#7f1d1d;border-color:#991b1b} #dupB.alert:hover{background:#991b1b}
|
|
@@ -1863,15 +1863,23 @@ function renderDims(){return `<g class=dimsg>${renderDimsInner()}</g>`;}
|
|
|
1863
1863
|
const GC=()=>window.GridCore||null;
|
|
1864
1864
|
function gridOn(){return !!(typeof P!=='undefined'&&P&&P.grid&&P.grid.on!==false);}
|
|
1865
1865
|
function gridGeo(){const gc=GC();if(!gc||typeof P==='undefined'||!P||!P.grid)return null;try{return gc.gridGeometry(P.grid,(P.pt_per_ft>0)?P.pt_per_ft:1);}catch(_){return null;}}
|
|
1866
|
+
// A grid <line> element (.gridhit) → its two endpoints [[x,y],[x,y]], or null. Mirrors the axis/index decode
|
|
1867
|
+
// in the grid-drag path so a grid line can also serve as an extend/trim target.
|
|
1868
|
+
function gridLineEndpoints(el){const geo=gridGeo();if(!geo||!el||!el.dataset)return null;
|
|
1869
|
+
const free=el.dataset.gl!=null,axis=free?'l':(el.dataset.gv!=null?'v':(el.dataset.gh!=null?'h':null));if(!axis)return null;
|
|
1870
|
+
const gi=+(free?el.dataset.gl:(el.dataset.gv!=null?el.dataset.gv:el.dataset.gh));if(!isFinite(gi))return null;
|
|
1871
|
+
const line=free?(geo.lines||[])[gi]:geo[axis][gi];if(!line)return null;
|
|
1872
|
+
return free?[line.a.slice(),line.b.slice()]:(axis==='v'?[[line.x,line.lo],[line.x,line.hi]]:[[line.lo,line.y],[line.hi,line.y]]);}
|
|
1866
1873
|
function gridSvg(){
|
|
1867
1874
|
if(!gridOn())return '';
|
|
1868
1875
|
const geo=gridGeo();if(!geo||(!geo.v.length&&!geo.h.length&&!(geo.lines&&geo.lines.length)))return '';
|
|
1869
1876
|
const R=11/zoom,F=12/zoom;
|
|
1870
1877
|
let s='<g id=gridG>';
|
|
1871
1878
|
const gsel=i=>selGridIds.has(i)?' sel':''; // marquee/Ctrl+A grid selection → highlight the visible line
|
|
1872
|
-
|
|
1873
|
-
geo.
|
|
1874
|
-
|
|
1879
|
+
const gTip=geoMode==='el'?'extend/trim target':'drag to move'; // while Extend/Trim is armed, a grid line is a target (drag is disabled) — don't promise "drag to move"
|
|
1880
|
+
geo.v.forEach((l,i)=>{s+=`<line class="gridln${gsel('gv:'+i)}" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}"/><line class="gridhit gv" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
1881
|
+
geo.h.forEach((l,i)=>{s+=`<line class="gridln${gsel('gh:'+i)}" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}"/><line class="gridhit gh" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
1882
|
+
(geo.lines||[]).forEach((l,i)=>{s+=`<line class="gridln${gsel('gl:'+(l.id!=null?l.id:i))}" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}"/><line class="gridhit gl" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
1875
1883
|
const bub=(x,y,lb,ax,i,end)=>`<g class=gridbubg data-${ax}="${i}" data-end="${end}" data-tip="Grid ${esc(lb)} — drag to move or adjust · dbl-click to rename · click to edit the grid"><circle class=gridbub data-bx="${x}" data-by="${y}" cx="${x}" cy="${y}" r="${R}"/><text class=gridtx data-bx="${x}" data-by="${y}" x="${x}" y="${y}" style="font-size:${F}px">${esc(lb)}</text></g>`;
|
|
1876
1884
|
geo.v.forEach((l,i)=>{s+=bub(l.x,l.lo,l.label,'gv',i,0)+bub(l.x,l.hi,l.label,'gv',i,1);});
|
|
1877
1885
|
geo.h.forEach((l,i)=>{s+=bub(l.lo,l.y,l.label,'gh',i,0)+bub(l.hi,l.y,l.label,'gh',i,1);});
|
|
@@ -2117,7 +2125,7 @@ function renderGridPanel(p){
|
|
|
2117
2125
|
document.getElementById('gridRemoveB').onclick=()=>{edit(()=>{P.grid=null;});};
|
|
2118
2126
|
document.getElementById('gridDoneB').onclick=()=>{setGridMode(false);render();};
|
|
2119
2127
|
}
|
|
2120
|
-
function setGeo(){document.body.classList.toggle('geo',!!geoMode);}
|
|
2128
|
+
function setGeo(){document.body.classList.toggle('geo',!!geoMode);document.body.classList.toggle('geoel',geoMode==='el');} // geoel = Extend/Trim armed; grid lines are a target ONLY then (not in Split), so their crosshair/highlight keys off geoel, not geo
|
|
2121
2129
|
// --- repeat last command (AutoCAD/Tekla): when NO tool is active, Space/Enter re-invokes the last command ---
|
|
2122
2130
|
let lastCmd=null;
|
|
2123
2131
|
function setLastCmd(label,run){lastCmd={label,run};}
|
|
@@ -2249,7 +2257,7 @@ function esc(s){return String(s).replace(/[<>&"]/g,c=>({'<':'<','>':'>','&
|
|
|
2249
2257
|
function render(){
|
|
2250
2258
|
document.body.classList.remove('snapping'); // a wholesale svg rebuild drops any #snapMark → clear the cursor-hide flag too (the next pointermove re-adds it if still snapping)
|
|
2251
2259
|
buildColorRank(); // refresh the model-global colour rank before any colorFor() call below (B2 — keeps 2D hues stable across plans + matched to 3D)
|
|
2252
|
-
if(geoMode&&(selIds.size<1||(geoMode==='split'&&selIds.size!==1))){geoMode=null;
|
|
2260
|
+
if(geoMode&&(selIds.size<1||(geoMode==='split'&&selIds.size!==1))){geoMode=null;setGeo();} // Split needs exactly one member; Extend/Trim works on any selection. setGeo() clears BOTH geo + geoel (not a bare remove('geo')) so the grid affordance can't outlive the tool
|
|
2253
2261
|
let s=overlaySvg(); // crisp vector linework (snappable) when the sheet has vectors; raster only for scanned PDFs
|
|
2254
2262
|
s+=gridSvg(); // structural grid under the linework (members/dims stay on top)
|
|
2255
2263
|
for(const sg of P.segments) s+=`<line class=seg data-seg="${sg.id}" x1="${sg.a[0]}" y1="${sg.a[1]}" x2="${sg.b[0]}" y2="${sg.b[1]}"/>`;
|
|
@@ -2745,7 +2753,7 @@ function panel(){
|
|
|
2745
2753
|
<div class=seg2 style="margin-top:6px"><button id=rot0>0°</button><button id=rot90>90°</button><button id=rot180>180°</button><button id=rot270>270°</button></div>
|
|
2746
2754
|
<div class=divrow><hr><span class=sect style="margin:0">Modify geometry</span><hr></div>
|
|
2747
2755
|
<div class=seg2 style="margin-top:0"><button id=geoEL class="${geoMode==='el'?'on':''}">Extend / Trim all</button></div>
|
|
2748
|
-
<div class=hint style="margin-top:6px">${geoMode==='el'?'Click a <b>target line</b> — the nearest end of <b>every</b> selected member snaps to where it meets that line.':'<b>Extend/Trim</b> (E) every selected member\'s nearest end to one line. <b>Esc</b> cancels.'}</div>
|
|
2756
|
+
<div class=hint style="margin-top:6px">${geoMode==='el'?'Click a <b>target line</b> (member, segment, or grid line) — the nearest end of <b>every</b> selected member snaps to where it meets that line.':'<b>Extend/Trim</b> (E) every selected member\'s nearest end to one line. <b>Esc</b> cancels.'}</div>
|
|
2749
2757
|
<div class=row><button class=ghostw id=swapEnds data-tip="Reverse every selected member: swap each one's start and end (yellow ↔ magenta / bottom ↔ top) handles · Shortcut: P">⇄ Swap start ↔ end (all) <span style="opacity:.55">(P)</span></button></div>
|
|
2750
2758
|
<div class="row f"><button class=danger id=del>Delete selected (${arr.length})</button></div>`;
|
|
2751
2759
|
wireTypeFilter(p);
|
|
@@ -2929,7 +2937,7 @@ function panel(){
|
|
|
2929
2937
|
<div class=seg2 style="margin-top:6px"><button id=rot0 class="${rotN===0?'on':''}">0°</button><button id=rot90 class="${rotN===90?'on':''}">90°</button><button id=rot180 class="${rotN===180?'on':''}">180°</button><button id=rot270 class="${rotN===270?'on':''}">270°</button></div>
|
|
2930
2938
|
${br?'':`<div class=divrow><hr><span class=sect style="margin:0">Modify geometry</span><hr></div>
|
|
2931
2939
|
<div class=seg2 style="margin-top:0"><button id=geoEL class="${geoMode==='el'?'on':''}">Extend / Trim</button><button id=geoSplit class="${geoMode==='split'?'on':''}">Split</button></div>
|
|
2932
|
-
<div class=hint style="margin-top:6px">${geoMode==='el'?'Click a <b>target line</b> — another member or a
|
|
2940
|
+
<div class=hint style="margin-top:6px">${geoMode==='el'?'Click a <b>target line</b> — another member, a grey segment, or a grid line. The nearest end of this member snaps to where the two lines meet (extends if short, trims if it overshoots).':geoMode==='split'?'Click a <b>point on this member</b> to cut it into two members.':'<b>Extend/Trim</b> (E) an end to meet another line · <b>Split</b> (S) at a point. <b>Esc</b> cancels.'}</div>
|
|
2933
2941
|
<div class=row><button class=ghostw id=swapEnds data-tip="Reverse the member: swap the start (${col?'bottom':'yellow'}) and end (${col?'top':'magenta'}) handles · Shortcut: P">⇄ Swap start ↔ end <span style="opacity:.55">(P)</span></button></div>`}
|
|
2934
2942
|
<div class="row f"><button class=danger id=del>Delete member</button></div>`;
|
|
2935
2943
|
wireTypeFilter(p);
|
|
@@ -3998,7 +4006,8 @@ svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
|
3998
4006
|
if(tm&&isBrace(tm))toast('A brace can’t be an extend/trim target — its drawn line is offset from its work points'); // clicking the VISIBLE brace body would silently target its invisible baseline
|
|
3999
4007
|
else if(tm)tgt=[tm.wp[0],tm.wp[1]];}
|
|
4000
4008
|
else if(t.classList.contains('seg')){const sg=P.segments.find(s=>s.id===t.dataset.seg);if(sg)tgt=[sg.a,sg.b];}
|
|
4001
|
-
if(
|
|
4009
|
+
else if(t.classList.contains('gridhit')){const gp=gridLineEndpoints(t);if(gp)tgt=gp;} // a grid line is a valid target — its two endpoints define the line to meet
|
|
4010
|
+
if(tgt){geoMode=null;setGeo();if(!snapEndMulti(sel2d(),tgt[0],tgt[1]))render();} // miss (empty/own line) keeps the mode armed; a 0-result target (all parallel / all braces) still needs a render() to un-arm the panel + grid affordance (snapEndMulti only renders when it moved something)
|
|
4002
4011
|
return;}
|
|
4003
4012
|
if(t.classList.contains('handle')){const id=t.dataset.mid||[...selIds][0],m=byId(id),h=+t.dataset.h;if(!m)return;buildSnap(id);
|
|
4004
4013
|
drag={type:'end',h,id,anchor:m.wp[1-h].slice(),orig:m.wp[h].slice(),pre:snapshot()};svg.setPointerCapture(e.pointerId);e.preventDefault();return;} // anchor = the fixed end (length ref); orig = where this end started (moved ref)
|
|
@@ -6395,7 +6404,7 @@ function setPlan(i){C.active=i;P=C.plans[i];
|
|
|
6395
6404
|
profs=[...new Set([...P.members.map(m=>m.profile), ...Object.keys(WT)])].sort();
|
|
6396
6405
|
// undo/redo is one GLOBAL stack (module-level, declared once) — NOT swapped per plane. A plane switch
|
|
6397
6406
|
// must not reset or re-scope undo, since snapshots are whole-model and selection/edits span sheets.
|
|
6398
|
-
selIds=new Set();findHits=new Set();selGridIds=new Set();picking=false;pickKind='profile';pickEnd=null;mode='sel';geoMode=null; // findHits + selGridIds reset per plan like selIds — a stale highlight (or, for grids, an index-based id) must not bleed onto another sheet (grids are per-plan)
|
|
6407
|
+
selIds=new Set();findHits=new Set();selGridIds=new Set();picking=false;pickKind='profile';pickEnd=null;mode='sel';geoMode=null;setGeo(); // findHits + selGridIds reset per plan like selIds — a stale highlight (or, for grids, an index-based id) must not bleed onto another sheet (grids are per-plan). setGeo() clears body.geo/geoel so an armed Extend/Trim tool doesn't leave the grid crosshair on the next sheet
|
|
6399
6408
|
dimMode=false;dimChain=false;dimSplitMode=false;selDimIds=new Set();setDimMode(); // Dimension tool resets per plan (incl. chain + split); setDimMode syncs the button/body.dimon classes + clears any draft/preview/chain (dimsVisible persists across plans)
|
|
6400
6409
|
setMode(); // Add-member likewise resets per plan: syncs body.add (crosshair) + the button off, and drops any in-progress start point (a plan-pixel draft is stale on another sheet)
|
|
6401
6410
|
if(gridMode||gridPick||gridLinePick){if(gridLinePick&&gridLinePick.line)gridLinePick.line.remove();gridMode=false;gridPick=false;gridLinePick=null;gridSetPickClass();} // grid panel/pick disarms per plan like the other takeover tools (a leaked pick would set geometry in the WRONG sheet's display space)
|
package/dist/web/workspaces.js
CHANGED
|
@@ -968,7 +968,7 @@
|
|
|
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>';
|
|
969
969
|
const note = graph.truncated ? `<div class="kb-view-note">Showing ${graph.nodes.length} — graph truncated (some pages omitted)</div>` : '';
|
|
970
970
|
return '<section class="kb-col kb-graph"><div class="kb-graph-head"><span>Knowledge graph</span>' + overview + '</div>' +
|
|
971
|
-
'<div class="kb-graph-sub">' + legend + '<span class="kb-g-hint">Click a node to open its page · scroll to zoom</span></div>' +
|
|
971
|
+
'<div class="kb-graph-sub">' + legend + '<span class="kb-g-hint">Click a node to open its page · scroll to zoom · drag to pan</span></div>' +
|
|
972
972
|
`<div class="kb-graph-body"><svg viewBox="0 0 ${W} ${H}" data-vb-base="0 0 ${W} ${H}" class="kb-graph-svg" role="group" aria-label="Knowledge graph">${lines}${dots}</svg>` +
|
|
973
973
|
`<button type="button" class="kb-g-fit" data-kb-fit hidden data-tip="Zoom to fit (Home)" aria-label="Zoom to fit">⤢ Fit</button></div>${note}</section>`;
|
|
974
974
|
}
|
|
@@ -990,6 +990,7 @@
|
|
|
990
990
|
const off = Math.abs(w - bw) > 0.5 || Math.abs(x - bx) > 0.5 || Math.abs(y - by) > 0.5;
|
|
991
991
|
const fit = svg.parentElement.querySelector('[data-kb-fit]');
|
|
992
992
|
if (fit) fit.hidden = !off;
|
|
993
|
+
svg.classList.toggle('kb-zoomed', w < bw - 0.5); // pannable (zoomed in) → the SVG shows a grab cursor
|
|
993
994
|
}
|
|
994
995
|
function kbFitGraph(svg) { const b = svg.dataset.vbBase.split(' ').map(Number); kbSetVb(svg, b[0], b[1], b[2], b[3]); }
|
|
995
996
|
function kbZoomGraph(svg, clientX, clientY, factor) {
|
|
@@ -1701,6 +1702,42 @@
|
|
|
1701
1702
|
e.preventDefault();
|
|
1702
1703
|
kbZoomGraph(svg, e.clientX, e.clientY, e.deltaY < 0 ? 0.85 : 1 / 0.85);
|
|
1703
1704
|
}, { passive: false });
|
|
1705
|
+
// Drag to pan — mirrors the main canvas's pan model (web/app.js): MIDDLE-mouse anywhere, OR LEFT-drag
|
|
1706
|
+
// on empty background (never a node — those open on click), so pan is reachable without a middle button
|
|
1707
|
+
// (trackpads have none). Window-level move/up track the drag past the SVG edge; client px ÷ the on-screen
|
|
1708
|
+
// (letterbox-fitted) scale → viewBox units, clamped to the content box like zoom. Only starts when zoomed
|
|
1709
|
+
// in — at fit there's nothing outside the box, so a press there is a true no-op (no cursor flip).
|
|
1710
|
+
let kbPan = null;
|
|
1711
|
+
$wsKnowledge.addEventListener('mousedown', (e) => {
|
|
1712
|
+
const svg = e.target.closest('.kb-graph-svg');
|
|
1713
|
+
if (!svg) return;
|
|
1714
|
+
const isMiddle = e.button === 1;
|
|
1715
|
+
const isLeftBg = e.button === 0 && !e.target.closest('.kb-g-node');
|
|
1716
|
+
if (!isMiddle && !isLeftBg) return;
|
|
1717
|
+
if (isMiddle) e.preventDefault(); // kill middle-click autoscroll even at fit
|
|
1718
|
+
const [x, y, w, h] = svg.getAttribute('viewBox').split(' ').map(Number);
|
|
1719
|
+
const [, , bw, bh] = svg.dataset.vbBase.split(' ').map(Number);
|
|
1720
|
+
if (w >= bw && h >= bh) return; // at fit: nothing to pan
|
|
1721
|
+
e.preventDefault(); // suppress text selection while dragging
|
|
1722
|
+
const rect = svg.getBoundingClientRect();
|
|
1723
|
+
const scale = Math.min(rect.width / w, rect.height / h); // on-screen px per viewBox unit (meet)
|
|
1724
|
+
kbPan = { svg, sx: e.clientX, sy: e.clientY, vx: x, vy: y, w, h, scale, bw, bh };
|
|
1725
|
+
svg.classList.add('kb-panning');
|
|
1726
|
+
});
|
|
1727
|
+
window.addEventListener('mousemove', (e) => {
|
|
1728
|
+
if (!kbPan) return;
|
|
1729
|
+
const { svg, sx, sy, vx, vy, w, h, scale, bw, bh } = kbPan;
|
|
1730
|
+
if (!svg.isConnected) { kbPan = null; return; } // graph re-rendered (generation change) mid-drag — drop the stale ref
|
|
1731
|
+
const nx = Math.max(0, Math.min(bw - w, vx - (e.clientX - sx) / scale));
|
|
1732
|
+
const ny = Math.max(0, Math.min(bh - h, vy - (e.clientY - sy) / scale));
|
|
1733
|
+
kbSetVb(svg, nx, ny, w, h); // node counter-scale is unchanged during a pan (w fixed) — a redundant but cheap re-apply, bounded by the graph's node cap
|
|
1734
|
+
});
|
|
1735
|
+
window.addEventListener('mouseup', () => {
|
|
1736
|
+
if (!kbPan) return;
|
|
1737
|
+
kbPan.svg.classList.remove('kb-panning');
|
|
1738
|
+
kbPan = null;
|
|
1739
|
+
});
|
|
1740
|
+
$wsKnowledge.addEventListener('auxclick', (e) => { if (e.button === 1) e.preventDefault(); }); // suppress the middle-click default aux action (paste / new-tab); autoscroll is already killed on mousedown
|
|
1704
1741
|
// Graph nodes are keyboard-focusable (tabindex="0" role="button") but SVG <g> elements have no
|
|
1705
1742
|
// native activation behaviour, so Enter/Space must be wired explicitly.
|
|
1706
1743
|
$wsKnowledge.addEventListener('keydown', (e) => {
|