Skip to content

Commit

Permalink
Implement Label ClipText.
Browse files Browse the repository at this point in the history
  • Loading branch information
PJB3005 committed May 28, 2019
1 parent f9e192b commit 300c2c0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Robust.Client/UserInterface/Controls/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public Label()
}

private string _text;
private bool _clipText;

[ViewVariables]
public string Text
Expand All @@ -42,6 +43,18 @@ public string Text
}
}

[ViewVariables]
public bool ClipText
{
get => _clipText;
set
{
_clipText = value;
RectClipContent = value;
MinimumSizeChanged();
}
}

[ViewVariables] public AlignMode Align { get; set; }

[ViewVariables] public VAlignMode VAlign { get; set; }
Expand Down Expand Up @@ -190,6 +203,11 @@ protected override Vector2 CalculateMinimumSize()
DebugTools.Assert(_textDimensionCache.HasValue);
}

if (ClipText)
{
return (0, _textDimensionCache.Value.Height / UIScale);
}

var totalWidth = 0;
foreach (var width in _textDimensionCache.Value.Widths)
{
Expand Down

0 comments on commit 300c2c0

Please sign in to comment.