From 4e0739315443e2c91a1a33e442f3cd0c7e6e9f81 Mon Sep 17 00:00:00 2001 From: maforget <11904426+maforget@users.noreply.github.com> Date: Tue, 27 Aug 2024 01:19:38 -0400 Subject: [PATCH] Fix corner issue when zoom out on page change and RTL reading are both enabled --- ComicRack.Engine/Display/ComicDisplay.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ComicRack.Engine/Display/ComicDisplay.cs b/ComicRack.Engine/Display/ComicDisplay.cs index c6a3e33..3aafe8b 100644 --- a/ComicRack.Engine/Display/ComicDisplay.cs +++ b/ComicRack.Engine/Display/ComicDisplay.cs @@ -1641,19 +1641,14 @@ private void display_PageChanged(object sender, BookPageEventArgs e) { if (zoomInOutOnPageChange && oldZoom != 0f) { - bool flag = e.OldPage < e.Page; - if (RightToLeftReading && RightToLeftReadingMode == RightToLeftReadingMode.FlipParts) - { - flag = !flag; - } - if (flag) - { - ZoomTo(new Point(-500000, -500000), oldZoom); - } + bool goingForward = e.OldPage < e.Page; + bool RTL = RightToLeftReading && RightToLeftReadingMode == RightToLeftReadingMode.FlipParts; + int corner = RTL ? -1 : 1; + + if (goingForward) + ZoomTo(new Point(corner * -500000, -500000), oldZoom); //Next page: Arrive on Upper Left Corner, Upper Right with RTL else - { - ZoomTo(new Point(500000, 500000), oldZoom); - } + ZoomTo(new Point(corner * 500000, 500000), oldZoom); //Previous Page: Arrive on Bottom Right Corner, Bottom Left with RTL } oldZoom = 0f; }