summaryrefslogtreecommitdiff
path: root/platform/java/example/Viewer.java
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2017-02-02 15:55:40 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-02-06 17:10:40 +0100
commitc100c4c77a88782ba5c4634994171db611952d44 (patch)
tree5dc9e03790f4eebd0586ed21510465ad8f831a85 /platform/java/example/Viewer.java
parent931f3d9a6c3ab0fbfa3e365fe040e1b86c47e9fc (diff)
downloadmupdf-c100c4c77a88782ba5c4634994171db611952d44.tar.xz
Add bookmarks so we can find a location after reflowing a document.
Diffstat (limited to 'platform/java/example/Viewer.java')
-rw-r--r--platform/java/example/Viewer.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/java/example/Viewer.java b/platform/java/example/Viewer.java
index 1361a538..a924cf4b 100644
--- a/platform/java/example/Viewer.java
+++ b/platform/java/example/Viewer.java
@@ -383,12 +383,12 @@ public class Viewer extends Frame implements WindowListener, ActionListener, Ite
}
if (layoutEm != oldLayoutEm) {
- float oldPos = (pageNumber + 0.5f) / (float)pageCount;
+ long mark = doc.makeBookmark(pageNumber);
doc.layout(layoutWidth, layoutHeight, layoutEm);
updateOutline();
pageCount = doc.countPages();
pageLabel.setText("/ " + pageCount);
- pageNumber = (int)(oldPos * pageCount);
+ pageNumber = doc.findBookmark(mark);
}
if (zoomLevel != oldZoomLevel || pageNumber != oldPageNumber || layoutEm != oldLayoutEm || searchHits != oldSearchHits)