From a0ee905c8552a61d7a99a48b3151b1cdd555eece Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sat, 24 Dec 2022 14:21:05 +0100 Subject: [PATCH] Improved ShowImage scaling with smaller resolution --- P3D/Dialogues/ImageView.vb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/P3D/Dialogues/ImageView.vb b/P3D/Dialogues/ImageView.vb index 5a2313dbd..fd569bb43 100644 --- a/P3D/Dialogues/ImageView.vb +++ b/P3D/Dialogues/ImageView.vb @@ -35,9 +35,16 @@ If Me.Showing = True Then Dim FrameSize As Size = New Size(288, 288) Dim ImageSize As Size = New Size(288, 288) + Dim DefaultImageSize As Size = New Size(288, 288) If Texture.Width > Texture.Height Then FrameSize.Width = CInt(Math.Ceiling(Texture.Width / Texture.Height) * 288) ImageSize.Width = CInt(Texture.Width / Texture.Height * 288) + Dim ScaleInt = 9 + While ImageSize.Width > Core.windowSize.Width - 288 + ImageSize = New Size(CInt(Texture.Width / Texture.Height * 32 * ScaleInt), CInt(DefaultImageSize.Height / 9 * ScaleInt)) + FrameSize = New Size(CInt(Math.Ceiling(Texture.Width / Texture.Height) * 32 * ScaleInt), CInt(DefaultImageSize.Height / 9 * ScaleInt)) + ScaleInt -= 1 + End While While ImageSize.Width > FrameSize.Width - 32 FrameSize.Width += 32 End While @@ -45,6 +52,12 @@ If Texture.Height > Texture.Width Then FrameSize.Height = CInt(Math.Floor(Texture.Height / Texture.Width) * 288) ImageSize.Height = CInt(Texture.Height / Texture.Width * 288) + Dim ScaleInt = 9 + While ImageSize.Height > Core.windowSize.Height - 288 + ImageSize = New Size(CInt(DefaultImageSize.Height / 9 * ScaleInt), CInt(Texture.Height / Texture.Width * 32 * ScaleInt)) + FrameSize = New Size(CInt(DefaultImageSize.Width / 9 * ScaleInt), CInt(Math.Floor(Texture.Height / Texture.Width) * 32 * ScaleInt)) + ScaleInt -= 1 + End While While ImageSize.Height > FrameSize.Height - 32 FrameSize.Height += 32 End While