Skip to content

Commit

Permalink
Improve NaturalSize layout handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Aug 1, 2024
1 parent 1746100 commit 401885d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions NAPS2.Lib/EtoForms/Layout/LayoutControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ private SizeF UpdateFixedDimensions(LayoutContext context, SizeF size)
{
size.Width = Width.Value;
}
if (context.IsNaturalSizeQuery && NaturalWidth != null)
if (!context.IsLayout && NaturalWidth != null)
{
size.Width = Math.Max(size.Width, NaturalWidth.Value);
size.Width = NaturalWidth.Value;
}
if (Height != null)
{
Expand All @@ -169,9 +169,9 @@ private SizeF UpdateFixedDimensions(LayoutContext context, SizeF size)
{
size.Height = Math.Max(size.Height, MinHeight.Value);
}
if (context.IsNaturalSizeQuery && NaturalHeight != null)
if (!context.IsLayout && NaturalHeight != null)
{
size.Height = Math.Max(size.Height, NaturalHeight.Value);
size.Height = NaturalHeight.Value;
}
return size;
}
Expand Down

0 comments on commit 401885d

Please sign in to comment.