Skip to content

Commit

Permalink
Make AngleBox shrink automatically
Browse files Browse the repository at this point in the history
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
  • Loading branch information
Visne and PJB3005 committed Jan 3, 2024
1 parent f09b0fe commit 7bd29f4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SS14.Launcher/Views/AngleBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static readonly StyledProperty<AngleBoxSideStyle> SideStyleProperty

static AngleBox()
{
AffectsMeasure<AngleBox>(CornerSizeProperty, SideStyleProperty);
AffectsGeometry<AngleBox>(BoundsProperty, CornerSizeProperty, SideStyleProperty);
}

Expand All @@ -31,6 +32,21 @@ public AngleBoxSideStyle SideStyle
set => SetValue(SideStyleProperty, value);
}

protected override Size MeasureOverride(Size availableSize)
{
var style = SideStyle;
var c = CornerSize;

var size = new Size();
if ((style & AngleBoxSideStyle.OpenRight) == 0)
size += new Size(c, c);

if ((style & AngleBoxSideStyle.OpenLeft) == 0)
size += new Size(c, c);

return size;
}

protected override Geometry CreateDefiningGeometry()
{
var style = SideStyle;
Expand Down

0 comments on commit 7bd29f4

Please sign in to comment.