Skip to content

Commit 43018fe

Browse files
committed
fix table scroll bounds
1 parent d8531c0 commit 43018fe

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

Intersect.Client.Framework/GenericClasses/Rectangle.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ public Rectangle(Point position, Point size)
3737
Size = size;
3838
}
3939

40+
public Rectangle(Rectangle other)
41+
{
42+
X = other.X;
43+
Y = other.Y;
44+
Width = other.Width;
45+
Height = other.Height;
46+
}
47+
4048
public static Rectangle Intersect(Rectangle a, Rectangle b)
4149
{
4250
// MS.NET returns a non-empty rectangle if the two rectangles

Intersect.Client.Framework/Gwen/Control/Base.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,20 @@ public string? Name
734734
/// </summary>
735735
public Rectangle Bounds => mBounds;
736736

737+
public Rectangle OuterBounds
738+
{
739+
get
740+
{
741+
var margin = mMargin;
742+
Rectangle outerBounds = new(mBounds);
743+
outerBounds.X -= margin.Left;
744+
outerBounds.Y -= margin.Top;
745+
outerBounds.Width += margin.Left + margin.Right;
746+
outerBounds.Height += margin.Top + margin.Bottom;
747+
return outerBounds;
748+
}
749+
}
750+
737751
public bool ClipContents { get; set; } = true;
738752

739753
/// <summary>
@@ -3378,7 +3392,7 @@ public virtual Point GetChildrenSize()
33783392
continue;
33793393
}
33803394

3381-
var childBounds = child.Bounds;
3395+
var childBounds = child.OuterBounds;
33823396
min.X = Math.Min(min.X, childBounds.Left);
33833397
min.Y = Math.Min(min.Y, childBounds.Top);
33843398
max.X = Math.Max(max.X, childBounds.Right);

Intersect.Client.Framework/Gwen/Control/Layout/Table.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,8 @@ protected virtual Point ComputeColumnWidths(TableRow[]? rows = null)
613613
actualHeight += row.OuterHeight;
614614
}
615615

616+
actualHeight += Math.Max(0, rows.Length - 1) * CellSpacing.Y;
617+
616618
return new Point(actualWidth, actualHeight);
617619
}
618620

0 commit comments

Comments
 (0)