Skip to content

Commit 93c4562

Browse files
wehosHongzhi Wenclaude
authored
fix(chat): 移除 compact 态模型旁的悬浮最小化球 (Project-N-E-K-O#1595)
compact 态下 #reactChatWindowMinimizeButton 被 CSS 改造成漂在猫娘模型左侧的 50px 圆 + breathingGlow 呼吸灯。观感呆,且在 Electron Pet 窗口(index.html, 仅 subtitle-web-host)里发光会被窗口 shape 裁切。 - index.css:把"按钮变球"那段样式原地换成 display:none(保留选择器作既有测试分隔符) - app-react-chat-window.js:删球的 rAF 锚点追踪(sync/clearCompactMinimizeBallAnchor、 compactMinimizeBallSnapshot),geometry ballRect 恒 null,不再给桌面壳留不可见球的命中区 保留最小化宿主管线:按钮 DOM、click→toggleMinimized、setMinimized、折叠动画落点 getCompactMinimizeBallTarget 全留着;schedule/stopCompactMinimizeBallTracking 是 compact surface 主 rAF 循环(非球专用),未动。compact 态最小化入口的呈现方式后续单独设计。 Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1552cb3 commit 93c4562

2 files changed

Lines changed: 7 additions & 79 deletions

File tree

static/app-react-chat-window.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@
253253
var mobileExpandClickGuard = null;
254254
var mobileExpandVisualGuardTimer = 0;
255255
var compactMinimizeBallFrame = 0;
256-
var compactMinimizeBallSnapshot = '';
257256
var compactSurfaceAnchorSnapshot = '';
258257
var compactDesktopSurfaceAnchorSnapshot = '';
259258
var compactInteractionGeometrySnapshot = '';
@@ -1283,9 +1282,9 @@
12831282
});
12841283
var surfaceRects = surfaceItems.map(function (item) { return item.nativeRect; });
12851284
var baseSurfaceRects = baseSurfaceItems.map(function (item) { return item.nativeRect; });
1286-
var ballRect = isCompactHomeMinimizeBallEnabled() && !isElectronCompactExternalBallEnabled()
1287-
? normalizeCompactDomRect(getCompactMinimizeBallTarget())
1288-
: null;
1285+
// compact 态不再渲染模型旁的悬浮最小化球,故不再上报其 hit/native 区域,
1286+
// 避免 Electron 桌面壳为一个不可见的球保留点击区域(externalBall 仍走桌面外部球)。
1287+
var ballRect = null;
12891288
return {
12901289
mode: getCurrentChatSurfaceMode(),
12911290
compactChatState: getCurrentCompactChatState(),
@@ -1422,47 +1421,12 @@
14221421
syncCompactInteractionGeometry();
14231422
}
14241423

1425-
function clearCompactMinimizeBallAnchor() {
1426-
var shell = getShell();
1427-
if (!shell) return;
1428-
shell.style.removeProperty('--compact-minimize-ball-left');
1429-
shell.style.removeProperty('--compact-minimize-ball-top');
1430-
compactMinimizeBallSnapshot = '';
1431-
syncCompactInteractionGeometry();
1432-
}
1433-
1434-
function syncCompactMinimizeBallAnchor() {
1435-
var shell = getShell();
1436-
if (!shell) return;
1437-
if (!isCompactHomeMinimizeBallEnabled()) {
1438-
clearCompactMinimizeBallAnchor();
1439-
return;
1440-
}
1441-
1442-
var placement = getCompactMinimizeBallTarget();
1443-
if (!placement) {
1444-
clearCompactMinimizeBallAnchor();
1445-
return;
1446-
}
1447-
1448-
var snapshot = Math.round(placement.left) + ':' + Math.round(placement.top);
1449-
if (snapshot === compactMinimizeBallSnapshot) {
1450-
return;
1451-
}
1452-
1453-
compactMinimizeBallSnapshot = snapshot;
1454-
shell.style.setProperty('--compact-minimize-ball-left', Math.round(placement.left) + 'px');
1455-
shell.style.setProperty('--compact-minimize-ball-top', Math.round(placement.top) + 'px');
1456-
syncCompactInteractionGeometry();
1457-
}
1458-
14591424
function stopCompactMinimizeBallTracking() {
14601425
if (compactMinimizeBallFrame) {
14611426
window.cancelAnimationFrame(compactMinimizeBallFrame);
14621427
compactMinimizeBallFrame = 0;
14631428
}
14641429
compactSurfacePendingModelOpen = false;
1465-
clearCompactMinimizeBallAnchor();
14661430
clearCompactSurfaceAnchor();
14671431
}
14681432

@@ -1482,13 +1446,11 @@
14821446
return;
14831447
}
14841448
syncCompactSurfaceAnchor();
1485-
syncCompactMinimizeBallAnchor();
14861449
syncCompactInteractionGeometry();
14871450
compactMinimizeBallFrame = window.requestAnimationFrame(loop);
14881451
};
14891452

14901453
syncCompactSurfaceAnchor();
1491-
syncCompactMinimizeBallAnchor();
14921454
syncCompactInteractionGeometry();
14931455
compactMinimizeBallFrame = window.requestAnimationFrame(loop);
14941456
}

static/css/index.css

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,45 +1142,11 @@ body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"
11421142
pointer-events: auto;
11431143
}
11441144

1145+
/* compact 态不再把最小化按钮渲染成模型旁的悬浮球:呼吸灯外发光会被 Electron 窗口形状裁切,
1146+
且球漂在角色旁观感很怪。最小化的宿主管线(按钮 DOM、toggleMinimized、折叠动画)保留,
1147+
compact 态下的最小化入口呈现方式后续单独设计。 */
11451148
body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #reactChatWindowMinimizeButton {
1146-
position: fixed;
1147-
left: var(--compact-minimize-ball-left, 16px);
1148-
top: var(--compact-minimize-ball-top, calc(100vh - 84px));
1149-
right: auto;
1150-
}
1151-
1152-
body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #reactChatWindowMinimizeButton {
1153-
width: 50px;
1154-
height: 50px;
1155-
display: inline-flex !important;
1156-
visibility: visible !important;
1157-
opacity: 1 !important;
1158-
border-radius: 50%;
1159-
background-color: rgba(68, 183, 254, 0.15);
1160-
background-image: url('/static/icons/expand_icon_off_ball.png');
1161-
background-position: center;
1162-
background-repeat: no-repeat;
1163-
background-size: cover;
1164-
box-shadow: 0 0 8px rgba(68, 183, 254, 0.6);
1165-
animation: breathingGlow 2s ease-in-out infinite;
1166-
will-change: box-shadow;
1167-
transform: none;
1168-
pointer-events: auto;
1169-
z-index: 100001;
1170-
}
1171-
1172-
body.electron-chat-window.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #reactChatWindowMinimizeButton {
1173-
display: none !important;
1174-
pointer-events: none !important;
1175-
}
1176-
1177-
body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #reactChatWindowMinimizeButton:hover {
1178-
background-color: rgba(68, 183, 254, 0.2);
1179-
box-shadow: 0 0 12px rgba(68, 183, 254, 0.72);
1180-
}
1181-
1182-
body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #reactChatWindowMinimizeButton img {
1183-
opacity: 0;
1149+
display: none;
11841150
}
11851151

11861152
body.subtitle-web-host #react-chat-window-shell[data-chat-surface-mode="compact"]:not(.is-minimized):not(.is-collapsing):not(.is-expanding) #react-chat-window-root .compact-chat-surface-shell {

0 commit comments

Comments
 (0)