From 83736f1208a613d2457147c2df3f493228bab3cb Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 8 Jul 2020 17:14:42 +0800 Subject: ... --- src/ui/controls/TextControlService.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ui/controls/TextControlService.hpp') diff --git a/src/ui/controls/TextControlService.hpp b/src/ui/controls/TextControlService.hpp index 93a48c44..1108a3b2 100644 --- a/src/ui/controls/TextControlService.hpp +++ b/src/ui/controls/TextControlService.hpp @@ -7,6 +7,7 @@ #include "cru/ui/Control.hpp" #include "cru/ui/UiEvent.hpp" #include "cru/ui/render/CanvasRenderObject.hpp" +#include "cru/ui/render/ScrollRenderObject.hpp" #include "cru/ui/render/TextRenderObject.hpp" namespace cru::ui::controls { @@ -140,7 +141,8 @@ class TextControlService : public Object { log::TagDebug(log_tag, u"Text selection updated, range: {}, {}.", old_start, new_end); if (const auto scroll_render_object = this->GetScrollRenderObject()) { - // TODO: Implement this. + const auto caret_rect = text_render_object->GetCaretRect(); + scroll_render_object->ScrollToContain(caret_rect, Thickness{5.f}); } } -- cgit v1.2.3