From a29de108dcf5a700b7c55da5cad9c548e7adcec9 Mon Sep 17 00:00:00 2001 From: Ben Olden-Cooligan Date: Thu, 5 Sep 2024 21:49:32 -0700 Subject: [PATCH] Fix scaling for BufferLayoutElement --- .../EtoForms/Layout/BufferLayoutElement.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/NAPS2.Lib/EtoForms/Layout/BufferLayoutElement.cs b/NAPS2.Lib/EtoForms/Layout/BufferLayoutElement.cs index 699d3b7fab..e5449099cf 100644 --- a/NAPS2.Lib/EtoForms/Layout/BufferLayoutElement.cs +++ b/NAPS2.Lib/EtoForms/Layout/BufferLayoutElement.cs @@ -21,16 +21,21 @@ public BufferLayoutElement(LayoutElement element, int left, int top, int right, public override void DoLayout(LayoutContext context, RectangleF bounds) { - Element.DoLayout(context, - new RectangleF(bounds.X + Left, bounds.Top + Top, bounds.Width - Left - Right, - bounds.Height - Top - Bottom)); + Element.DoLayout(context, new RectangleF( + bounds.X + Left * context.Scale, + bounds.Y + Top * context.Scale, + bounds.Width - (Left + Right) * context.Scale, + bounds.Height - (Top + Bottom) * context.Scale)); } protected override SizeF GetPreferredSizeCore(LayoutContext context, RectangleF parentBounds) { return Element.GetPreferredSize(context, - new RectangleF(parentBounds.X + Left, parentBounds.Top + Top, parentBounds.Width - Left - Right, - parentBounds.Height - Top - Bottom)) - + new SizeF(Left + Right, Top + Bottom); + new RectangleF( + parentBounds.X + Left * context.Scale, + parentBounds.Y + Top * context.Scale, + parentBounds.Width - (Left + Right) * context.Scale, + parentBounds.Height - (Top + Bottom) * context.Scale)) + + new SizeF(Left + Right, Top + Bottom) * context.Scale; } } \ No newline at end of file