Add option to disable text clipping in text boxes

This commit is contained in:
Wojciech Figat
2022-08-05 14:38:18 +02:00
parent b23cf5f1d8
commit 9caf80bdc9
3 changed files with 14 additions and 4 deletions

View File

@@ -235,7 +235,8 @@ namespace FlaxEngine.GUI
Render2D.DrawRectangle(rect, IsFocused ? BorderSelectedColor : BorderColor);
// Apply view offset and clip mask
Render2D.PushClip(TextClipRectangle);
if (ClipText)
Render2D.PushClip(TextClipRectangle);
bool useViewOffset = !_viewOffset.IsZero;
if (useViewOffset)
Render2D.PushTransform(Matrix3x3.Translation2D(-_viewOffset));
@@ -355,7 +356,8 @@ namespace FlaxEngine.GUI
// Restore rendering state
if (useViewOffset)
Render2D.PopTransform();
Render2D.PopClip();
if (ClipText)
Render2D.PopClip();
}
/// <inheritdoc />

View File

@@ -158,7 +158,8 @@ namespace FlaxEngine.GUI
Render2D.DrawRectangle(rect, IsFocused ? BorderSelectedColor : BorderColor);
// Apply view offset and clip mask
Render2D.PushClip(TextClipRectangle);
if (ClipText)
Render2D.PushClip(TextClipRectangle);
bool useViewOffset = !_viewOffset.IsZero;
if (useViewOffset)
Render2D.PushTransform(Matrix3x3.Translation2D(-_viewOffset));
@@ -226,7 +227,8 @@ namespace FlaxEngine.GUI
// Restore rendering state
if (useViewOffset)
Render2D.PopTransform();
Render2D.PopClip();
if (ClipText)
Render2D.PopClip();
}
/// <inheritdoc />

View File

@@ -192,6 +192,12 @@ namespace FlaxEngine.GUI
}
}
/// <summary>
/// Gets or sets a value indicating whether apply clipping mask on text during rendering.
/// </summary>
[EditorOrder(529)]
public bool ClipText { get; set; } = true;
/// <summary>
/// Gets or sets textbox background color when the control is selected (has focus).
/// </summary>