From b666c192328ee2136c3dce2389cebd5a5255cd30 Mon Sep 17 00:00:00 2001 From: WMJ Date: Tue, 4 Feb 2025 09:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=8D=E4=BF=AE=E5=A4=8D=E4=B9=A6=E7=AD=BE?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E7=9B=AE=E6=A0=87=E4=B8=BA0=E6=97=B6?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=BD=93=E5=89=8D=E4=B9=A6=E7=AD=BE=E7=AA=81?= =?UTF-8?q?=E5=87=BA=E6=98=BE=E7=A4=BA=E5=8A=9F=E8=83=BD=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=B7=A5=E4=BD=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/Parts/BookmarkInViewSynchronizer.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/App/Functions/Editor/Parts/BookmarkInViewSynchronizer.cs b/App/Functions/Editor/Parts/BookmarkInViewSynchronizer.cs index edaf101..5d66a5a 100644 --- a/App/Functions/Editor/Parts/BookmarkInViewSynchronizer.cs +++ b/App/Functions/Editor/Parts/BookmarkInViewSynchronizer.cs @@ -67,17 +67,16 @@ namespace PDFPatcher.Functions.Editor.Parts float t = float.NaN; var h = _ViewerBox.HorizontalFlow; int start = 0, end = itemCount, i = itemCount >> 1, bp; - BookmarkElement b; + BookmarkElement b, c; // 使用二分法查找最近的书签,这里假设书签指向的页面从上到下是顺序的 while (i != start && i != end) { - b = _BookmarkBox.GetBookmark(i); - bp = b.Page; + c = _BookmarkBox.GetBookmark(i); + bp = c.Page; if (bp == 0) { - start = i; - if (i < end) { - ++i; - } + ++i; + continue; } + b = c; if (bp > p.Page) { end = i; i = start + ((i - start) >> 1);