From 0c4e30b87dd63d5bd88f57798ceca41670dc3ac2 Mon Sep 17 00:00:00 2001 From: fanlusky <1730976608@qq.com> Date: Tue, 16 Jun 2026 21:15:04 +0800 Subject: [PATCH] Remove scrollbar track inset --- ui/README.md | 1 + ui/src/Layout.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/README.md b/ui/README.md index fbead7ed..258f0f2e 100644 --- a/ui/README.md +++ b/ui/README.md @@ -72,6 +72,7 @@ - 将 demo 顶部的 `msimeui` 标题和副标题改为居中展示,并把标题上方留白收窄到原来的一半 - 修正了 demo 顶部标题区的居中方式:改为通过独立 header 容器居中内容,确保 `msimeui` 标题和描述文本在页面顶部真正水平居中 - 为 `TextBlock` 补充了文本水平对齐能力,demo 顶部标题区现改为使用真正的居中文本对齐,而不是仅靠外层布局盒子居中 +- 调整了 `ScrollViewer` 的纵向滚动条轨道边距,去掉上、下、右侧 inset,让滚动条更贴合视口右边缘 ## 构建 diff --git a/ui/src/Layout.cpp b/ui/src/Layout.cpp index 0afebb47..9f640557 100644 --- a/ui/src/Layout.cpp +++ b/ui/src/Layout.cpp @@ -1082,9 +1082,7 @@ void ScrollViewer::RefreshViewport() RectF ScrollViewer::GetScrollbarTrackRect() const { constexpr float kScrollbarWidth = 10.0f; - constexpr float kScrollbarInset = 6.0f; - return {bounds_.x + bounds_.width - kScrollbarWidth - kScrollbarInset, bounds_.y + kScrollbarInset, kScrollbarWidth, - std::max(bounds_.height - kScrollbarInset * 2.0f, 0.0f)}; + return {bounds_.x + bounds_.width - kScrollbarWidth, bounds_.y, kScrollbarWidth, std::max(bounds_.height, 0.0f)}; } RectF ScrollViewer::GetScrollbarThumbRect() const