已选段终点改到圆钮中心:圆钮右侧不再露出橙色

- 现象:4× 放大图里橙色 filled 段的右端越到圆钮右侧之外(圆钮边缘能看到一小截橙色)
- 根因:渐变终点写成 `calc(20px + var(--strength-ratio) * (100% - 20px))`,而圆钮中心在 `10px + ratio * (100% - 20px)` —— 终点比圆钮中心多 10px(正好落在圆钮**右缘**),亚像素 / 圆角 / 描边误差都会让它露出来
- 改法:两个渐变停靠点都改成 `calc(10px + var(--strength-ratio, 0) * (100% - 20px))`,filled 段右端与圆钮中心重合;100% 时圆钮压在轨道右端、填充与圆钮右缘齐平
- 实测(无头 Chromium,4× 设备像素):0/25/50/75/100% 五档沿轨道中线扫描,圆钮右缘以外主色像素命中数 **0**(改前对照图能看到橙色溢出);hover / active / focus-visible / disabled 四态同样 0
- 守卫:`chatDialogFrameLayout.test.ts` 断言轨道渐变停靠点含 `calc(10px + var(--strength-ratio, 0) * (100% - 20px))` 且不含 `calc(20px + …)`

Refs #600, PR #607
This commit is contained in:
2026-10-05 18:56:35 +08:00
parent fe3c1389ae
commit dd6e5186b0
2 changed files with 18 additions and 4 deletions
+5 -4
View File
@@ -11526,14 +11526,15 @@ button.design-workspace-tree__entry:hover,
.project-chat-composer-strength-range::-webkit-slider-runnable-track {
height: 6px;
border-radius: 999px;
/* 已选段一直铺到圆钮右缘(`--strength-ratio` 是无单位档位比例,20px = 圆钮直径),
圆钮右缘之外才是未选段;`calc` 让两端在任意轨道宽度下都对齐。 */
/* 已选段终点 = **圆钮中心**(`--strength-ratio` 是无单位档位比例;圆钮中心 =
10px + ratio * (100% - 20px),两端各留一个圆钮半径)。原先终点写成 20px + …(= 圆钮
**右缘**),亚像素 / 圆角 / 描边一有误差就在圆钮右侧露出一小截橙色。 */
background: linear-gradient(
to right,
var(--platform-accent) 0
calc(20px + var(--strength-ratio, 0) * (100% - 20px)),
calc(10px + var(--strength-ratio, 0) * (100% - 20px)),
var(--platform-subpanel-border)
calc(20px + var(--strength-ratio, 0) * (100% - 20px)) 100%
calc(10px + var(--strength-ratio, 0) * (100% - 20px)) 100%
);
}
@@ -429,6 +429,19 @@ describe('陶泥儿对话区:Codex 三段式(顶栏 / 唯一滚动区 / 文
expect(sectionPadding.right).toBe(0);
expect(sectionPadding.top).toBe(4);
expect(sectionPadding.bottom).toBe(2);
// 已选段终点必须与**圆钮中心**重合(`10px + ratio * (100% - 20px)`):写成 `20px + …`
// (= 圆钮**右缘**)时圆钮右侧会露出一小截橙色(4× 设备像素实拍对照见 PR)。
const track = desktopDeclarations(
`${STRENGTH_RANGE}::-webkit-slider-runnable-track`,
);
const trackBackground = declaration(track, 'background');
expect(trackBackground).toContain(
'calc(10px + var(--strength-ratio, 0) * (100% - 20px))',
);
expect(trackBackground).not.toContain(
'calc(20px + var(--strength-ratio, 0) * (100% - 20px))',
);
});
it('窄屏(390px)输入盒仍在文档流、四周有边距,列表底部没有留白', () => {