From 5c6c04d70ae086b1b93948ffd9a69859721f7e4f Mon Sep 17 00:00:00 2001 From: Aisland Date: Wed, 2 Sep 2026 20:31:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(console):=20=E8=81=8A=E5=A4=A9=E5=88=86?= =?UTF-8?q?=E9=9A=94=E7=BA=BF=E4=BF=AE=E5=A4=8D=E2=80=94=E2=80=94=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=90=8E=E6=8C=89=E8=A7=84=E6=A0=BC=E9=92=B3=E5=88=B6?= =?UTF-8?q?=E5=AD=98=E6=A1=A3chatW(=E8=84=8F=E5=80=BC1067=E2=86=92600,setC?= =?UTF-8?q?hatW=E5=90=8C=E5=85=9C=E5=BA=95max)=EF=BC=9B=E5=88=86=E9=9A=94?= =?UTF-8?q?=E7=BA=BF=E5=90=91=E5=86=85=E5=AE=B9=E4=BE=A7=E5=81=8F=E7=A7=BB?= =?UTF-8?q?3px,=E9=81=BF=E5=BC=80=E4=B8=8E=E5=AE=BF=E4=B8=BB=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E5=8C=BA2px=E9=87=8D=E5=8F=A0(=E4=B8=8D=E5=8A=A0?= =?UTF-8?q?=E5=AE=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01_content/lib/client.js | 9 +++++++-- 01_content/src/client/split.tsx | 10 ++++++++-- 02_process/tmp-check.ps1 | 2 ++ 02_process/tmp-drag.ps1 | 2 ++ 02_process/tmp-drag2.ps1 | 2 ++ 02_process/tmp-hit.ps1 | 4 ++++ 02_process/tmp-hit2.ps1 | 2 ++ 02_process/tmp-probe-divider.ps1 | 6 ++++++ 02_process/tmp-rebind.ps1 | 4 ++++ 02_process/tmp-spec.ps1 | 2 ++ 02_process/tmp-zindex.ps1 | 4 ++++ 11 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 02_process/tmp-check.ps1 create mode 100644 02_process/tmp-drag.ps1 create mode 100644 02_process/tmp-drag2.ps1 create mode 100644 02_process/tmp-hit.ps1 create mode 100644 02_process/tmp-hit2.ps1 create mode 100644 02_process/tmp-probe-divider.ps1 create mode 100644 02_process/tmp-rebind.ps1 create mode 100644 02_process/tmp-spec.ps1 create mode 100644 02_process/tmp-zindex.ps1 diff --git a/01_content/lib/client.js b/01_content/lib/client.js index 84e10f0..c92a826 100644 --- a/01_content/lib/client.js +++ b/01_content/lib/client.js @@ -17344,6 +17344,11 @@ var splitStore = { this.savedMarginRight = viewArea.style.marginRight; this.savedMarginTop = viewArea.style.marginTop; this.refreshGeom(); + if (this.geom) { + const minContent = main.reduce((a, p) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP; + const hi = Math.max(spec.chatWidth.min, this.geom.right - this.geom.left - minContent); + this.chatW = clamp(Math.round(this.chatW), spec.chatWidth.min, Math.min(spec.chatWidth.max, hi)); + } const g0 = this.geom; if (g0) { const colW0 = g0.right - g0.left; @@ -17482,7 +17487,7 @@ var splitStore = { const main = spec.main ?? []; const minContent = main.reduce((a, p) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP; const hi = Math.max(spec.chatWidth.min, colW - minContent); - this.chatW = clamp(Math.round(w), spec.chatWidth.min, hi); + this.chatW = clamp(Math.round(w), spec.chatWidth.min, Math.min(spec.chatWidth.max, hi)); this.applyMargin(); this.persist(); this.notify(); @@ -19744,7 +19749,7 @@ function WorkspaceLayer(props) { title: hasLeft ? "\u62D6\u52A8\u8C03\u6574\u5DE6\u53F3\u5217\u5BBD" : "\u62D6\u52A8\u8C03\u6574\u804A\u5929\u5BBD\u5EA6", style: { position: "fixed", - left: (hasLeft ? g.left + leftW : chatLeft ? g.left + chatW : g.right - chatW) - DIVIDER / 2, + left: (hasLeft ? g.left + leftW : chatLeft ? g.left + chatW : g.right - chatW) - DIVIDER / 2 + (hasLeft ? 0 : chatLeft ? 3 : -3), top: hasLeft || chatFull ? barTop + BAR_H : bodyTop, width: DIVIDER, height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH, diff --git a/01_content/src/client/split.tsx b/01_content/src/client/split.tsx index 04a24c0..9022bfa 100644 --- a/01_content/src/client/split.tsx +++ b/01_content/src/client/split.tsx @@ -797,6 +797,12 @@ export const splitStore: SplitState = { this.savedMarginRight = viewArea.style.marginRight this.savedMarginTop = viewArea.style.marginTop this.refreshGeom() + // 存档 sanitize:chatW 等尺寸按本布局规格钳制(防老版本/脏存值越界,如 1067 > max 600) + if (this.geom) { + const minContent = main.reduce((a: number, p: SplitPane) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP + const hi = Math.max(spec.chatWidth.min, (this.geom.right - this.geom.left) - minContent) + this.chatW = clamp(Math.round(this.chatW), spec.chatWidth.min, Math.min(spec.chatWidth.max, hi)) + } // 均衡默认:无存档尺寸时按当前可用空间比例分配, // 不再出现“其余窗全部贴 min、最后一个吃掉全部余量”的悬殊观感。 const g0 = this.geom @@ -951,7 +957,7 @@ export const splitStore: SplitState = { const main = spec.main ?? [] const minContent = main.reduce((a, p) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP const hi = Math.max(spec.chatWidth.min, colW - minContent) - this.chatW = clamp(Math.round(w), spec.chatWidth.min, hi) + this.chatW = clamp(Math.round(w), spec.chatWidth.min, Math.min(spec.chatWidth.max, hi)) this.applyMargin() this.persist() this.notify() @@ -3053,7 +3059,7 @@ function WorkspaceLayer(props: { spec: LayoutSpec; geom: Geom | null; chatW: num title={hasLeft ? '拖动调整左右列宽' : '拖动调整聊天宽度'} style={{ position: 'fixed', - left: (hasLeft ? g.left + leftW : (chatLeft ? g.left + chatW : g.right - chatW)) - DIVIDER / 2, + left: (hasLeft ? g.left + leftW : (chatLeft ? g.left + chatW : g.right - chatW)) - DIVIDER / 2 + (hasLeft ? 0 : (chatLeft ? 3 : -3)), top: hasLeft || chatFull ? barTop + BAR_H : bodyTop, width: DIVIDER, height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH, diff --git a/02_process/tmp-check.ps1 b/02_process/tmp-check.ps1 new file mode 100644 index 0000000..be88b67 --- /dev/null +++ b/02_process/tmp-check.ps1 @@ -0,0 +1,2 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "JSON.stringify({ hasWT: !!window.__dshWorktable, active: window.__dshWorktable ? window.__dshWorktable.splitStore.active : null, consoleEls: document.querySelectorAll('.dsh-wt_console').length, dividerEls: document.querySelectorAll('.dsh-wt_splitDivider').length, url: location.href.slice(0, 60) })" diff --git a/02_process/tmp-drag.ps1 b/02_process/tmp-drag.ps1 new file mode 100644 index 0000000..0bee9af --- /dev/null +++ b/02_process/tmp-drag.ps1 @@ -0,0 +1,2 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; const d = document.querySelector('.dsh-wt_splitDivider'); if (!s || !d) return 'no'; const before = s.chatW; const r = d.getBoundingClientRect(); const x = r.left + 2; const y = r.top + 300; const pd = new PointerEvent('pointerdown', { bubbles: true, clientX: x, clientY: y, pointerId: 7, button: 0, isPrimary: true }); d.dispatchEvent(pd); window.dispatchEvent(new PointerEvent('pointermove', { bubbles: true, clientX: x - 40, clientY: y, pointerId: 7 })); window.dispatchEvent(new PointerEvent('pointerup', { bubbles: true, clientX: x - 40, clientY: y, pointerId: 7 })); return JSON.stringify({ before: before, after: s.chatW }); })()" diff --git a/02_process/tmp-drag2.ps1 b/02_process/tmp-drag2.ps1 new file mode 100644 index 0000000..c49673d --- /dev/null +++ b/02_process/tmp-drag2.ps1 @@ -0,0 +1,2 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; const d = document.querySelector('.dsh-wt_splitDivider'); if (!s || !d) return 'no'; const before = s.chatW; const r = d.getBoundingClientRect(); const x = r.left + 2; const y = r.top + 300; const ev = (type, cx) => new PointerEvent(type, { bubbles: true, clientX: cx, clientY: y, pointerId: 7, button: 0, isPrimary: true }); d.dispatchEvent(ev('pointerdown', x)); d.dispatchEvent(ev('pointermove', x - 60)); d.dispatchEvent(ev('pointerup', x - 60)); return JSON.stringify({ before: before, after: s.chatW, dividerX: Math.round(r.left), viewportW: window.innerWidth }); })()" diff --git a/02_process/tmp-hit.ps1 b/02_process/tmp-hit.ps1 new file mode 100644 index 0000000..0f263d1 --- /dev/null +++ b/02_process/tmp-hit.ps1 @@ -0,0 +1,4 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.active || !s.geom) return 'no-active'; const x = s.geom.right - s.chatW - 2; const y = (s.geom.top + s.geom.bottom) / 2; const el = document.elementFromPoint(x, y); const chain = []; let n = el, d = 0; while (n && d < 4) { chain.push(n.tagName + '.' + String(n.className).split(' ').slice(0, 3).join('.') + ' z=' + getComputedStyle(n).zIndex); n = n.parentElement; d++; } return JSON.stringify({ x: Math.round(x), y: Math.round(y), hit: chain }); })()" +Start-Sleep -Milliseconds 400 +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.geom) return 'no-s'; const rects = []; const d = document.querySelector('.dsh-wt_splitDivider'); if (d) { const r = d.getBoundingClientRect(); const cx = r.left + r.width / 2; const cy = r.top + r.height / 2; const el = document.elementFromPoint(cx, cy); rects.push({ divider: [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)].join(','), atCenter: el && (el.classList.contains('dsh-wt_splitDivider') ? 'DIVIDER' : el.tagName + '.' + String(el.className).split(' ').slice(0, 2).join('.')) }); } return JSON.stringify({ chatW: s.chatW, right: Math.round(s.geom.right), rects }); })()" diff --git a/02_process/tmp-hit2.ps1 b/02_process/tmp-hit2.ps1 new file mode 100644 index 0000000..4795fc5 --- /dev/null +++ b/02_process/tmp-hit2.ps1 @@ -0,0 +1,2 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.active || !s.geom) return 'no-active'; const d = document.querySelector('.dsh-wt_splitDivider'); if (!d) return 'no-divider-el'; const r = d.getBoundingClientRect(); const cx = r.left + r.width / 2; const cy = r.top + r.height / 2; const el = document.elementFromPoint(cx, cy); const chain = []; let n = el, dep = 0; while (n && dep < 4) { chain.push(n.tagName + '.' + String(n.className).split(' ').slice(0, 3).join('.') + '|z=' + getComputedStyle(n).zIndex); n = n.parentElement; dep++; } return JSON.stringify({ dividerRect: [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)].join(','), atCenter: el && (el.classList && el.classList.contains('dsh-wt_splitDivider')) ? 'DIVIDER' : 'OTHER', chain }); })()" diff --git a/02_process/tmp-probe-divider.ps1 b/02_process/tmp-probe-divider.ps1 new file mode 100644 index 0000000..7dc1b7f --- /dev/null +++ b/02_process/tmp-probe-divider.ps1 @@ -0,0 +1,6 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; return s && s.active ? JSON.stringify({ right: s.geom && s.geom.right, chatW: s.chatW, bar: BARH_dummy || undefined }) : 'no-split'; })()" +Start-Sleep -Milliseconds 300 +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.active || !s.geom) return 'no-active'; const x = s.geom.right - s.chatW - 2; const y = (s.geom.top + s.geom.bottom) / 2; const el = document.elementFromPoint(x, y); const arr = []; let n = el; let d = 0; while (n && d < 3) { arr.push(n.tagName + '.' + String(n.className).split(' ').slice(0,3).join('.')); n = n.parentElement; d++; } return JSON.stringify({ x: Math.round(x), y: Math.round(y), hit: arr }); })()" +Start-Sleep -Milliseconds 300 +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.geom) return 'no'; const x = s.geom.right - s.chatW - 2; const y = (s.geom.top + s.geom.bottom) / 2; const el = document.elementFromPoint(x, y); return el ? (el.closest('.dsh-wt_splitDivider') ? 'hit-divider' : el.closest('[data-phase]') ? 'hit-host-chat' : el.closest('.dsh-wt_pane') ? 'hit-pane' : 'hit-other:' + el.tagName) : 'null'; })()" diff --git a/02_process/tmp-rebind.ps1 b/02_process/tmp-rebind.ps1 new file mode 100644 index 0000000..384e976 --- /dev/null +++ b/02_process/tmp-rebind.ps1 @@ -0,0 +1,4 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt unbind 2>$null | Out-Null +Start-Sleep -Milliseconds 400 +opencli --profile 74u3g3us browser wt bind diff --git a/02_process/tmp-spec.ps1 b/02_process/tmp-spec.ps1 new file mode 100644 index 0000000..e8ebe17 --- /dev/null +++ b/02_process/tmp-spec.ps1 @@ -0,0 +1,2 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const s = window.__dshWorktable && window.__dshWorktable.splitStore; if (!s || !s.spec) return 'no'; return JSON.stringify({ id: s.spec.id, title: s.spec.title, top: s.spec.top ? s.spec.top.length : null, mainLen: s.spec.main ? s.spec.main.length : null, chatW: s.chatW, chatWDef: s.spec.chatWidth }); })()" diff --git a/02_process/tmp-zindex.ps1 b/02_process/tmp-zindex.ps1 new file mode 100644 index 0000000..e9ad3cb --- /dev/null +++ b/02_process/tmp-zindex.ps1 @@ -0,0 +1,4 @@ +$ErrorActionPreference = 'Stop' +opencli --profile 74u3g3us browser wt eval "(() => { const root = document.querySelector('[data-phase]'); if (!root) return 'no-root'; const out = []; let el = root; let d = 0; while (el && d < 8) { const cs = getComputedStyle(el); out.push({ tag: el.tagName, z: cs.zIndex, pos: cs.position, cls: String(el.className).slice(0, 40) }); el = el.parentElement; d++; } return JSON.stringify(out); })()" +Start-Sleep -Milliseconds 300 +opencli --profile 74u3g3us browser wt eval "(() => { const divs = Array.from(document.querySelectorAll('.dsh-wt_splitDivider')); return JSON.stringify({ count: divs.length, one: divs[0] ? { z: getComputedStyle(divs[0]).zIndex, pos: getComputedStyle(divs[0]).position, rect: (() => { const r = divs[0].getBoundingClientRect(); return [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)].join(','); })() } : null }); })()"