aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-07-08 17:14:42 +0800
committercrupest <crupest@outlook.com>2020-07-08 17:14:42 +0800
commit83736f1208a613d2457147c2df3f493228bab3cb (patch)
tree5bd44c7d1676c040f4cd61b9862a418d5b8ba29c /src/ui/controls
parent3a49e87637e2493f3e5854bbcb8ab804bae5a46e (diff)
downloadcru-83736f1208a613d2457147c2df3f493228bab3cb.tar.gz
cru-83736f1208a613d2457147c2df3f493228bab3cb.tar.bz2
cru-83736f1208a613d2457147c2df3f493228bab3cb.zip
...
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/TextControlService.hpp4
1 files changed, 3 insertions, 1 deletions
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});
}
}