aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render/ScrollRenderObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/render/ScrollRenderObject.cpp')
-rw-r--r--src/ui/render/ScrollRenderObject.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/ui/render/ScrollRenderObject.cpp b/src/ui/render/ScrollRenderObject.cpp
index e4cc27f3..aab8c003 100644
--- a/src/ui/render/ScrollRenderObject.cpp
+++ b/src/ui/render/ScrollRenderObject.cpp
@@ -31,17 +31,6 @@ Point CoerceScroll(const Point& scroll_offset, const Size& content_size,
}
} // namespace
-void ScrollRenderObject::Draw(platform::graph::IPainter* painter) {
- if (const auto child = GetSingleChild()) {
- painter->PushLayer(this->GetPaddingRect());
- const auto offset = child->GetOffset();
- platform::graph::util::WithTransform(
- painter, Matrix::Translation(offset.x, offset.y),
- [child](platform::graph::IPainter* p) { child->Draw(p); });
- painter->PopLayer();
- }
-}
-
RenderObject* ScrollRenderObject::HitTest(const Point& point) {
if (const auto child = GetSingleChild()) {
const auto offset = child->GetOffset();
@@ -53,6 +42,18 @@ RenderObject* ScrollRenderObject::HitTest(const Point& point) {
return rect.IsPointInside(point) ? this : nullptr;
} // namespace cru::ui::render
+void ScrollRenderObject::OnDrawCore(platform::graph::IPainter* painter) {
+ DefaultDrawContent(painter);
+ if (const auto child = GetSingleChild()) {
+ painter->PushLayer(this->GetPaddingRect());
+ const auto offset = child->GetOffset();
+ platform::graph::util::WithTransform(
+ painter, Matrix::Translation(offset.x, offset.y),
+ [child](platform::graph::IPainter* p) { child->Draw(p); });
+ painter->PopLayer();
+ }
+}
+
Point ScrollRenderObject::GetScrollOffset() {
if (const auto child = GetSingleChild())
return CoerceScroll(scroll_offset_, GetContentRect().GetSize(),