Add option to disable text clipping in text boxes
This commit is contained in:
@@ -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 />
|
||||
|
||||
@@ -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 />
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user