springtg / apv

Automatically exported from code.google.com/p/apv
GNU General Public License v3.0
0 stars 0 forks source link

apv should remember offsetY #148

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
i open a pdf file,and scroll to offsety(1000),offsetx(100).and exit apv.
when reopen the last pdf file, apv can't remember offsetY,it only scroll to 
current page top.

BookmarkEntry add offsety,and pageview restore offsetY to top.  it will improve 
ue.

    public int offsetY;

add constructor:
public BookmarkEntry(int numberOfPages, int page, float absoluteZoomLevel,
        int rotation, int offsetX, int offsetY) {
        this.comment = comment;
        this.numberOfPages = numberOfPages;
        this.page = page;
        this.absoluteZoomLevel = absoluteZoomLevel;
        this.rotation = rotation;
        this.offsetX = offsetX;
        this.offsetY=offsetY;
    }

public BookmarkEntry(String comment, String s) {
....
if (5 < data.length) {
            this.offsetY = Integer.parseInt(data[5]);
        }
        else {
            this.offsetY = 0;
        }

public String toString() {
        return ""+numberOfPages+" "+page+" "+absoluteZoomLevel+" "+rotation+" "+offsetX+" "+offsetY;
    }

public class PagesView:
public void goToBookmark() {
...
else {
            this.zoomLevel = (int)(this.bookmarkToRestore.absoluteZoomLevel / this.scaling0);
            this.rotation = this.bookmarkToRestore.rotation;
            //Point pos = getPagePositionInDocumentWithZoom(this.bookmarkToRestore.page);
            this.currentPage = this.bookmarkToRestore.page;
            this.top = /*pos.y + this.height / 2 + */this.bookmarkToRestore.offsetY;             //restore offsetY.
           this.left = this.getCurrentPageWidth(this.currentPage)/2 + marginX + this.bookmarkToRestore.offsetX;
            this.bookmarkToRestore = null;
        }

save offsety:
public BookmarkEntry toBookmarkEntry() {
        return new BookmarkEntry(this.pageSizes.length,
                this.currentPage, scaling0*zoomLevel, rotation, 
                this.left - this.getCurrentPageWidth(this.currentPage)/2 - marginX, this.top);
    }

Original issue reported on code.google.com by arc...@gmail.com on 12 Sep 2013 at 7:06