aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render/ScrollRenderObject.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-28 22:17:14 +0800
committercrupest <crupest@outlook.com>2020-06-28 22:17:14 +0800
commit427bd31059fcdca5806a149238e91173667953c1 (patch)
treedec0794e8445040f8b177aaa29e0600380e5420f /src/ui/render/ScrollRenderObject.cpp
parent26da84f59396075118ee769654471159e1f49980 (diff)
downloadcru-427bd31059fcdca5806a149238e91173667953c1.tar.gz
cru-427bd31059fcdca5806a149238e91173667953c1.tar.bz2
cru-427bd31059fcdca5806a149238e91173667953c1.zip
...
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(),