aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-28 15:37:33 +0800
committercrupest <crupest@outlook.com>2021-02-28 15:37:33 +0800
commita64ace1b09cb3c8594f510075ceffee17d8b7cfb (patch)
tree75a7a03f61d603faeaffc5c339c78a531599211e
parent38a5b9eddb75e07695ee38f0bd41d3fd76341a15 (diff)
downloadcru-a64ace1b09cb3c8594f510075ceffee17d8b7cfb.tar.gz
cru-a64ace1b09cb3c8594f510075ceffee17d8b7cfb.tar.bz2
cru-a64ace1b09cb3c8594f510075ceffee17d8b7cfb.zip
...
-rw-r--r--src/ui/render/ScrollBar.cpp10
-rw-r--r--src/ui/render/ScrollRenderObject.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ui/render/ScrollBar.cpp b/src/ui/render/ScrollBar.cpp
index 00deb479..fa53292e 100644
--- a/src/ui/render/ScrollBar.cpp
+++ b/src/ui/render/ScrollBar.cpp
@@ -193,7 +193,7 @@ ScrollBar::GetExpandedArrowBrush() const {
gsl::not_null<std::shared_ptr<platform::graphics::IBrush>>
ScrollBar::GetExpandedArrowBackgroundBrush() const {
// TODO: Read theme resource.
- return expanded_arrow_brush_;
+ return expanded_arrow_background_brush_;
}
void ScrollBar::OnDraw(platform::graphics::IPainter* painter,
@@ -357,8 +357,8 @@ float HorizontalScrollBar::CalculateNewScrollPosition(
new_thumb_start =
std::clamp(new_thumb_start, scroll_area_start, thumb_head_end);
- auto offset = new_thumb_start / (scroll_area_end - scroll_area_start) *
- child_size.width;
+ auto offset = (new_thumb_start - scroll_area_start) /
+ (scroll_area_end - scroll_area_start) * child_size.width;
return offset;
}
@@ -482,8 +482,8 @@ float VerticalScrollBar::CalculateNewScrollPosition(
new_thumb_start =
std::clamp(new_thumb_start, scroll_area_start, thumb_head_end);
- auto offset = new_thumb_start / (scroll_area_end - scroll_area_start) *
- child_size.height;
+ auto offset = (new_thumb_start - scroll_area_start) /
+ (scroll_area_end - scroll_area_start) * child_size.width;
return offset;
}
diff --git a/src/ui/render/ScrollRenderObject.cpp b/src/ui/render/ScrollRenderObject.cpp
index 0a81eaab..fd5143ff 100644
--- a/src/ui/render/ScrollRenderObject.cpp
+++ b/src/ui/render/ScrollRenderObject.cpp
@@ -85,7 +85,7 @@ RenderObject* ScrollRenderObject::HitTest(const Point& point) {
void ScrollRenderObject::OnDrawCore(platform::graphics::IPainter* painter) {
DefaultDrawContent(painter);
if (const auto child = GetSingleChild()) {
- painter->PushLayer(this->GetPaddingRect());
+ painter->PushLayer(this->GetContentRect());
const auto offset = child->GetOffset();
platform::graphics::util::WithTransform(
painter, Matrix::Translation(offset.x, offset.y),