1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-21 20:50:07 +00:00
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 page idx vs no
tracking current page tracking current page
more js annoatation
pdf:mobile device
pdf:miui pdf:miui
tmp dir: use pid tmp dir: use pid
remove page from dom -- UI option remove page from dom -- UI option

View File

@ -73,6 +73,9 @@ var EPS = 1e-6;
/************************************/ /************************************/
/* utility function */ /* utility function */
/**
* @param{Array.<number>} ctm
*/
function invert(ctm) { function invert(ctm) {
var det = ctm[0] * ctm[3] - ctm[1] * ctm[2]; var det = ctm[0] * ctm[3] - ctm[1] * ctm[2];
return [ ctm[3] / det return [ ctm[3] / det
@ -83,6 +86,10 @@ function invert(ctm) {
,(ctm[1] * ctm[4] - ctm[0] * ctm[5]) / det ,(ctm[1] * ctm[4] - ctm[0] * ctm[5]) / det
]; ];
}; };
/**
* @param{Array.<number>} ctm
* @param{Array.<number>} pos
*/
function transform(ctm, pos) { function transform(ctm, pos) {
return [ctm[0] * pos[0] + ctm[2] * pos[1] + ctm[4] return [ctm[0] * pos[0] + ctm[2] * pos[1] + ctm[4]
,ctm[1] * pos[0] + ctm[3] * pos[1] + ctm[5]]; ,ctm[1] * pos[0] + ctm[3] * pos[1] + ctm[5]];
@ -175,6 +182,9 @@ Page.prototype = {
this.shown = true; this.shown = true;
} }
}, },
/**
* @param{number} ratio
*/
rescale : function(ratio) { rescale : function(ratio) {
if(ratio == 0) { if(ratio == 0) {
// reset scale // reset scale
@ -234,9 +244,10 @@ Page.prototype = {
/** /**
* export pdf2htmlEX.Viewer * export pdf2htmlEX.Viewer
* @constructor * @constructor
* @param{Object=} config
*/ */
function Viewer(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.pages_loading = [];
this.init_before_loading_content(); 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) { schedule_render : function(renew) {
if(this.render_timer !== undefined) { if(this.render_timer !== undefined) {
@ -663,6 +674,9 @@ Viewer.prototype = {
return null; return null;
}, },
/**
* @param{Event} e
*/
link_handler : function (e) { link_handler : function (e) {
var target = e.target; var target = e.target;
@ -762,7 +776,7 @@ Viewer.prototype = {
/** /**
* @param{number} page_idx * @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) { scroll_to : function(page_idx, pos) {
var target_page = this.pages[page_idx]; var target_page = this.pages[page_idx];