This commit is contained in:
Lu Wang 2013-11-10 16:54:43 +08:00
parent 4a8d0bcd31
commit 8a192e03e0
2 changed files with 18 additions and 6 deletions

2
TODO
View File

@ -7,8 +7,6 @@ more information on demo page:
page idx vs no
tracking current page
more js annoatation
pdf:mobile device
pdf:miui
tmp dir: use pid
remove page from dom -- UI option

View File

@ -73,6 +73,9 @@ var EPS = 1e-6;
/************************************/
/* utility function */
/**
* @param{Array.<number>} ctm
*/
function invert(ctm) {
var det = ctm[0] * ctm[3] - ctm[1] * ctm[2];
return [ ctm[3] / det
@ -83,6 +86,10 @@ function invert(ctm) {
,(ctm[1] * ctm[4] - ctm[0] * ctm[5]) / det
];
};
/**
* @param{Array.<number>} ctm
* @param{Array.<number>} pos
*/
function transform(ctm, pos) {
return [ctm[0] * pos[0] + ctm[2] * pos[1] + ctm[4]
,ctm[1] * pos[0] + ctm[3] * pos[1] + ctm[5]];
@ -175,6 +182,9 @@ Page.prototype = {
this.shown = true;
}
},
/**
* @param{number} ratio
*/
rescale : function(ratio) {
if(ratio == 0) {
// reset scale
@ -234,9 +244,10 @@ Page.prototype = {
/**
* export pdf2htmlEX.Viewer
* @constructor
* @param{Object=} config
*/
function Viewer(config) {
this.config = clone_and_extend_objs(DEFAULT_CONFIG, config);
this.config = clone_and_extend_objs(DEFAULT_CONFIG, (arguments.length > 0 ? config : {}));
this.pages_loading = [];
this.init_before_loading_content();
@ -446,8 +457,8 @@ Viewer.prototype = {
}
},
/*
* renew: renew the existing schedule instead of using the old one
/**
* @param{boolean} renew renew the existing schedule instead of using the old one
*/
schedule_render : function(renew) {
if(this.render_timer !== undefined) {
@ -663,6 +674,9 @@ Viewer.prototype = {
return null;
},
/**
* @param{Event} e
*/
link_handler : function (e) {
var target = e.target;
@ -762,7 +776,7 @@ Viewer.prototype = {
/**
* @param{number} page_idx
* @param{Array=} pos [x,y] in UNSCALED COORDINATION, where (0,0) is the top-left corner
* @param{Array.<number>=} pos [x,y] in UNSCALED COORDINATION, where (0,0) is the top-left corner
*/
scroll_to : function(page_idx, pos) {
var target_page = this.pages[page_idx];