fix(console): 聊天分隔线修复——加载后按规格钳制存档chatW(脏值1067→600,setChatW同兜底max);分隔线向内容侧偏移3px,避开与宿主聊天区2px重叠(不加宽)
This commit is contained in:
@@ -17344,6 +17344,11 @@ var splitStore = {
|
|||||||
this.savedMarginRight = viewArea.style.marginRight;
|
this.savedMarginRight = viewArea.style.marginRight;
|
||||||
this.savedMarginTop = viewArea.style.marginTop;
|
this.savedMarginTop = viewArea.style.marginTop;
|
||||||
this.refreshGeom();
|
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;
|
const g0 = this.geom;
|
||||||
if (g0) {
|
if (g0) {
|
||||||
const colW0 = g0.right - g0.left;
|
const colW0 = g0.right - g0.left;
|
||||||
@@ -17482,7 +17487,7 @@ var splitStore = {
|
|||||||
const main = spec.main ?? [];
|
const main = spec.main ?? [];
|
||||||
const minContent = main.reduce((a, p) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP;
|
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);
|
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.applyMargin();
|
||||||
this.persist();
|
this.persist();
|
||||||
this.notify();
|
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",
|
title: hasLeft ? "\u62D6\u52A8\u8C03\u6574\u5DE6\u53F3\u5217\u5BBD" : "\u62D6\u52A8\u8C03\u6574\u804A\u5929\u5BBD\u5EA6",
|
||||||
style: {
|
style: {
|
||||||
position: "fixed",
|
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,
|
top: hasLeft || chatFull ? barTop + BAR_H : bodyTop,
|
||||||
width: DIVIDER,
|
width: DIVIDER,
|
||||||
height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH,
|
height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH,
|
||||||
|
|||||||
@@ -797,6 +797,12 @@ export const splitStore: SplitState = {
|
|||||||
this.savedMarginRight = viewArea.style.marginRight
|
this.savedMarginRight = viewArea.style.marginRight
|
||||||
this.savedMarginTop = viewArea.style.marginTop
|
this.savedMarginTop = viewArea.style.marginTop
|
||||||
this.refreshGeom()
|
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、最后一个吃掉全部余量”的悬殊观感。
|
// 不再出现“其余窗全部贴 min、最后一个吃掉全部余量”的悬殊观感。
|
||||||
const g0 = this.geom
|
const g0 = this.geom
|
||||||
@@ -951,7 +957,7 @@ export const splitStore: SplitState = {
|
|||||||
const main = spec.main ?? []
|
const main = spec.main ?? []
|
||||||
const minContent = main.reduce((a, p) => a + p.min, 0) + Math.max(0, main.length - 1) * GAP
|
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)
|
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.applyMargin()
|
||||||
this.persist()
|
this.persist()
|
||||||
this.notify()
|
this.notify()
|
||||||
@@ -3053,7 +3059,7 @@ function WorkspaceLayer(props: { spec: LayoutSpec; geom: Geom | null; chatW: num
|
|||||||
title={hasLeft ? '拖动调整左右列宽' : '拖动调整聊天宽度'}
|
title={hasLeft ? '拖动调整左右列宽' : '拖动调整聊天宽度'}
|
||||||
style={{
|
style={{
|
||||||
position: 'fixed',
|
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,
|
top: hasLeft || chatFull ? barTop + BAR_H : bodyTop,
|
||||||
width: DIVIDER,
|
width: DIVIDER,
|
||||||
height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH,
|
height: hasLeft || chatFull ? g.bottom - barTop - BAR_H : mainH,
|
||||||
|
|||||||
@@ -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) })"
|
||||||
@@ -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 }); })()"
|
||||||
@@ -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 }); })()"
|
||||||
@@ -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 }); })()"
|
||||||
@@ -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 }); })()"
|
||||||
@@ -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'; })()"
|
||||||
@@ -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
|
||||||
@@ -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 }); })()"
|
||||||
@@ -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 }); })()"
|
||||||
Reference in New Issue
Block a user