Results 1 to 7 of 7
Like Tree3Likes
  • 3 Post By devwithoutpower
  1.    #1  
    Part1 - modify PxxView.jsjsjs so you can use simple tap to navigate prev/next page:
    Modify (from line 79)
    Code:
        toggleToolbar: function() {
            if(this.$.main_toolbar.showing) {
                this.$.main_toolbar.hide();
                this.$.pageNumbering.hide();
            } else {
                this.$.main_toolbar.show();
                this.$.pageNumbering.show();
            }
    to
    Code:
        toggleToolbar: function(x, e) {
        	if(e.y > window.screen.height/2) {
        		if(e.x < window.screen.width/3)
        			this.previousPage();
        		else if(e.x > window.screen.width*2/3)
        			this.nextPage();	
        		return;
        	}
            if(this.$.main_toolbar.showing) {
                this.$.main_toolbar.hide();
                this.$.pageNumbering.hide();
            } else {
                this.$.main_toolbar.show();
                this.$.pageNumbering.show();
            }
    With this change you tap bottom-left part of the screen for PREVIOUS and bottom-right part for NEXT page.

    Part2 - modify PxxArea.jsjsjs so when you zoom in, current zoom level is saved and then everytime you change page it is reset to saved value.

    I) Add (after line 43)
    Code:
    onGetRight: "getNextPage",
    to
    Code:
    onGetRight: "getNextPage",
    onSnapFinish: "resetZoom",
    II) Add (after line 257)
    Code:
        goToPage: function(page) {
            this.setCurrentPage(page-1);
            this.$.onePageView.setCenterView(this.$.onePageView.images[page-1]);
        },
    to
    Code:
        goToPage: function(page) {
            this.setCurrentPage(page-1);
            this.$.onePageView.setCenterView(this.$.onePageView.images[page-1]);
            setTimeout(this.resetZoom.bind(this), 0);
        },
    III) Add following 3 functions
    Code:
        gestureendHandler: function(x, event) {
        	if(event.type==="gestureend")
        		this.currentZoom = this.$.onePageView.fetchCurrentView().getZoom();
        },
    
        dragfinishHandler: function(x, event) {
        	if(event.type==="dragfinish")
    		this.resetZoom();
        },
    
        resetZoom: function() {
        	if(this.currentZoom!==undefined) {
    		var lv = this.$.onePageView.fetchView('left');
    		var cv = this.$.onePageView.fetchView('center');
    		var rv = this.$.onePageView.fetchView('right');
    		if(lv) lv.setZoom(this.currentZoom);
    		if(cv) cv.setZoom(this.currentZoom);
    		if(rv) rv.setZoom(this.currentZoom);
    	}
        }
    Note: line numbers taken from AR 10.3.406, not tested with eariler versions
  2. #2  
    Working beautifully, thanks.

    Note that if you're applying these changes on top of kjhenrie's ipk patch you need to change the versions of the files that are in the 'source\patches' folder, not the original ones under 'source'. (It would be great to have these changes rolled into that ipk.)

    It might also be worth noting above that you need a final comma to separate the three new functions from later ones in the file (or a leading comma if you're tucking them in at the end).
  3. #3  
    You neat me to it! I just finished coding something similar to this a few minutes ago! Lol, happy people are still working to improve the PDF reader.
    Edit: Do you mind if this patch is if this is added to the patches ipk?
    Last edited by knownboyofno; 11/01/2011 at 01:02 PM. Reason: question added
  4.    #4  
    Quote Originally Posted by knownboyofno View Post
    You neat me to it! I just finished coding something similar to this a few minutes ago! Lol, happy people are still working to improve the PDF reader.
    Edit: Do you mind if this patch is if this is added to the patches ipk?
    Feel free to add this patch into IPK.
  5. #5  
    Thanks for the hard work and allowing it to be added.
  6. #6  
    I will be uploading a new version of the ipk that contains this patch and the TOC patch. Thanks for the excellent contributions devwithoutpower.
  7. #7  
    The patched ipk including this patch and more is available for download. View the OP here for details and credits.

Tags for this Thread

Posting Permissions