Make TargetViewOffset only go to bottom of text. Add Scroll to Carrot for new lines.

This commit is contained in:
Chandler Cox
2024-03-22 12:09:41 -05:00
parent 4cd788cedc
commit 495de38c48

View File

@@ -1265,7 +1265,7 @@ namespace FlaxEngine.GUI
// Multiline scroll // Multiline scroll
if (IsMultiline && _text.Length != 0 && IsMultilineScrollable) if (IsMultiline && _text.Length != 0 && IsMultilineScrollable)
{ {
TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y)); TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y - Height));
return true; return true;
} }
@@ -1456,6 +1456,7 @@ namespace FlaxEngine.GUI
{ {
// Insert new line // Insert new line
Insert('\n'); Insert('\n');
ScrollToCaret();
} }
else if (!IsNavFocused) else if (!IsNavFocused)
{ {