Mercurial > hg > digilib-old
annotate client/digitallibrary/greyskin/dllib.js @ 490:fc322b1af8ec
new servlet version 1.7.0b
- changed semaphore code to use Java 1.5
- changed digilib worker to do write the output outside the semaphore
author | robcast |
---|---|
date | Thu, 02 Aug 2007 19:22:47 +0200 |
parents | 351c5924b7a6 |
children | e91d6050f27d |
rev | line source |
---|---|
485
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
1 /* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
2 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
3 This program is free software; you can redistribute it and/or |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
4 modify it under the terms of the GNU General Public License |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
5 as published by the Free Software Foundation; either version 2 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
6 of the License, or (at your option) any later version. |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
7 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
8 This program is distributed in the hope that it will be useful, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
9 but WITHOUT ANY WARRANTY; without even the implied warranty of |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
11 GNU General Public License for more details. |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
12 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
14 along with this program; if not, write to the Free Software |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
16 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
17 Authors: |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
18 Christian Luginbuehl, 01.05.2003 (first version) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
19 DW 24.03.2004 (Changed for digiLib in Zope) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
20 Robert Casties, 8.11.2005 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
21 Martin Raspe <hertzhaft@biblhertz.it>, 12.12.2005 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
22 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
23 ! Requires baselib.js ! |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
24 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
25 */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
26 digilibVersion = "Digilib NG"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
27 dllibVersion = "2.040"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
28 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
29 function identify() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
30 // used for identifying a digilib instance |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
31 // Relato uses that function - lugi |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
32 return digilibVersion; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
33 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
34 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
35 function createMarkDiv(index) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
36 var div = document.createElement("div"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
37 div.className = "mark"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
38 div.id = "mark" + index; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
39 div.innerHTML = index + 1; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
40 document.body.appendChild(div); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
41 return div; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
42 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
43 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
44 function bestPicSize(elem, inset) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
45 // returns a Size with the best image size for the given element |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
46 if (! defined(inset)) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
47 inset = 25; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
48 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
49 var ws = getWinSize(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
50 var es = getElementPosition(elem); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
51 if (es) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
52 ws.width = ws.width - es.x - inset; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
53 ws.height = ws.height - es.y - inset; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
54 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
55 return ws; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
56 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
57 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
58 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
59 /**************************************************** |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
60 * digilib specific classes (must be defined first) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
61 ****************************************************/ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
62 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
63 /* |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
64 * Marks class |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
65 */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
66 function Marks() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
67 return this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
68 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
69 // Marks inherits from Array |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
70 Marks.prototype = new Array(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
71 Marks.prototype.parse = function(query) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
72 this.length = 0; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
73 if (query.indexOf(";") >= 0) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
74 var pa = query.split(";"); // old format with ";" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
75 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
76 var pa = query.split(","); // new format |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
77 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
78 for (var i = 0; i < pa.length ; i++) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
79 var pos = pa[i].split("/"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
80 if (pos.length > 1) this.push(new Position(pos[0], pos[1])); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
81 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
82 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
83 Marks.prototype.getAll = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
84 var ma = new Array(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
85 for (var i = 0; i < this.length; i++) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
86 ma.push(cropFloat(this[i].x) + "/" + cropFloat(this[i].y)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
87 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
88 return ma.join(","); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
89 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
90 Marks.prototype.addEvent = function(evt, digilib) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
91 // add a mark from a screen event |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
92 if (!digilib) digilib = dl; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
93 var pos = digilib.trafo.invtransform(evtPosition(evt)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
94 this.push(pos); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
95 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
96 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
97 /* |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
98 * DLParameters -- digilib parameter class |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
99 */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
100 function DLParameters() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
101 // flags for parameter sets |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
102 this.PARAM_FILE = 1; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
103 this.PARAM_MODE = 2; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
104 this.PARAM_DIM = 4; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
105 this.PARAM_IMAGE = 8; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
106 this.PARAM_DPI = 16; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
107 this.PARAM_SIZE = 32; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
108 this.PARAM_MARK = 64; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
109 this.PARAM_PAGES = 128; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
110 this.PARAM_CLIENT = 256; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
111 /* request parameters */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
112 with (this) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
113 // file |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
114 define('fn', '', PARAM_FILE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
115 define('pn', '1', PARAM_FILE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
116 // mode |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
117 define('mo', '', PARAM_MODE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
118 // relative dimensions of zoomed image |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
119 define('wx', '0.0', PARAM_DIM); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
120 define('wy', '0.0', PARAM_DIM); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
121 define('ww', '1.0', PARAM_DIM); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
122 define('wh', '1.0', PARAM_DIM); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
123 // image manipulation |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
124 define('brgt', '0.0', PARAM_IMAGE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
125 define('cont', '0.0', PARAM_IMAGE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
126 define('rot', '0.0', PARAM_IMAGE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
127 define('rgba', '', PARAM_IMAGE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
128 define('rgbm', '', PARAM_IMAGE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
129 // resolution |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
130 define('ddpi', '', PARAM_DPI); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
131 define('ddpix', '', PARAM_DPI); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
132 define('ddpiy', '', PARAM_DPI); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
133 // marks |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
134 define('mk', '', PARAM_MARK); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
135 // pages total |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
136 define('pt', '0', PARAM_PAGES); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
137 // size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
138 define('ws', '1.0', PARAM_SIZE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
139 // client side options |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
140 define('clop', '', PARAM_CLIENT); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
141 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
142 return this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
143 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
144 DLParameters.prototype = new Parameters(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
145 // move the inherited getAll because we need it later |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
146 DLParameters.prototype._getAll = Parameters.prototype.getAll; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
147 DLParameters.prototype.getAll = function(paDetail, moDetail, digilib) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
148 if (!digilib) digilib = dl; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
149 // get Flags and Marks first |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
150 var mo = digilib.flags.getAll(moDetail); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
151 this.set("mo", mo); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
152 var clop = digilib.opts.getAll(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
153 this.set("clop", clop); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
154 var mk = digilib.marks.getAll(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
155 this.set("mk", mk); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
156 var ret = this._getAll(paDetail); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
157 return ret; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
158 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
159 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
160 /* |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
161 * DLModes -- digilib flags class |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
162 */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
163 function DLFlags() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
164 // flags for mode sets |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
165 this.MODE_QUAL = 1; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
166 this.MODE_SIZE = 2; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
167 this.MODE_MIR = 4; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
168 this.MODE_OTHER = 128; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
169 this.MODE_ALL = 255; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
170 /* mode flags */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
171 with (this) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
172 define('q0', MODE_QUAL); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
173 define('q1', MODE_QUAL); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
174 define('q2', MODE_QUAL); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
175 define('fit', MODE_SIZE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
176 define('clip', MODE_SIZE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
177 define('osize', MODE_SIZE); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
178 define('vmir', MODE_MIR); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
179 define('hmir', MODE_MIR); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
180 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
181 return this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
182 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
183 // inherits from Flags |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
184 DLFlags.prototype = new Flags(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
185 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
186 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
187 /* |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
188 * Digilib -- digilib base class |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
189 */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
190 function Digilib() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
191 if (!baseLibVersion) alert("ERROR: baselib.js not loaded!"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
192 /* constants */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
193 this.MAX_AREA = new Rectangle(0.0, 0.0, 1.0, 1.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
194 // default inset (for scalerImg relativ to scalerDiv |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
195 this.INSET = 40; // because of scrollbars of main window and scaler [Firefox bug?] |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
196 // mouse drag area that counts as one click |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
197 this.MIN_AREA_SIZE = 3 * 3 + 1; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
198 // standard zoom factor |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
199 this.ZOOMFACTOR = Math.sqrt(2); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
200 // bird's eye view dimensions |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
201 this.BIRD_MAXX = 100; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
202 this.BIRD_MAXY = 100; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
203 // witdh of arrow bars |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
204 this.ARROW_WIDTH = 32; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
205 // width of calibration bar |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
206 this.CALIBRATION_WIDTH = 64; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
207 /* variables */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
208 this.fitOnlyWidth = false; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
209 this.fitOnlyHeight = false; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
210 this.trafo = null; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
211 // page elements |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
212 this.scalerDiv = null; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
213 this.scalerImg = null; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
214 this.buttons1Div = null; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
215 this.buttons2Div = null; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
216 /* parse parameters */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
217 this.params = new DLParameters(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
218 // put the query parameters (sans "?") in the parameters array |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
219 this.params.parse(location.search.slice(1)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
220 // treat special parameters |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
221 this.area = this.parseArea(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
222 this.marks = new Marks(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
223 this.marks.parse(this.params.get("mk")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
224 this.flags = new DLFlags(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
225 this.flags.parse(this.params.get("mo")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
226 this.opts = new Flags(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
227 this.opts.parse(this.params.get("clop")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
228 return this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
229 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
230 Digilib.prototype.setDLParam = function(e, s, relative) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
231 // sets parameter based on HTML event |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
232 var nam; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
233 var val; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
234 if (s.type && (s.type == "select-one")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
235 nam = s.name; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
236 val = s.options[s.selectedIndex].value; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
237 } else if (s.name && s.value) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
238 nam = s.name; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
239 val = s.value; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
240 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
241 if (nam && val) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
242 dl.params.set(nam, val, relative); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
243 display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
244 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
245 alert("ERROR: unable to process event!"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
246 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
247 return true; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
248 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
249 Digilib.prototype.parseArea = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
250 // returns area Rectangle from current parameters |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
251 return new Rectangle( |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
252 this.params.get("wx"), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
253 this.params.get("wy"), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
254 this.params.get("ww"), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
255 this.params.get("wh")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
256 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
257 Digilib.prototype.setParamFromArea = function(rect) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
258 // sets digilib wx etc. from rect |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
259 this.params.set("wx", cropFloat(rect.x)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
260 this.params.set("wy", cropFloat(rect.y)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
261 this.params.set("ww", cropFloat(rect.width)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
262 this.params.set("wh", cropFloat(rect.height)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
263 return true; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
264 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
265 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
266 Digilib.prototype.parseTrafo = function(elem) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
267 // returns Transform from current dlArea and picsize |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
268 var picsize = getElementRect(elem); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
269 var trafo = new Transform(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
270 // subtract area offset and size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
271 trafo.concat(trafo.getTranslation(new Position(-this.area.x, -this.area.y))); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
272 trafo.concat(trafo.getScale(new Size(1/this.area.width, 1/this.area.height))); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
273 // scale to screen size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
274 trafo.concat(trafo.getScale(picsize)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
275 trafo.concat(trafo.getTranslation(picsize)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
276 // FIX ME: Robert, kannst Du mal nachsehen, ob das folgende tut, was es soll? |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
277 // oder gibt es dafuer neuen Code? -- ROC: Bisher funktioniert es nicht! |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
278 // rotate |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
279 //var rot = getRotation(- dl.params.get("rot"), new Position(0.5*picsize.width, 0.5*picsize.height)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
280 //trafo.concat(rot); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
281 // mirror |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
282 //if (hasFlag("hmir")) trafo.m00 = - trafo.m00; // ?? |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
283 //if (hasFlag("vmir")) trafo.m11 = - trafo.m11; // ?? |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
284 return trafo; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
285 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
286 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
287 Digilib.prototype.onLoad = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
288 // initialize digilib; called by body.onload |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
289 this.scalerDiv = getElement("scaler", true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
290 this.scalerImg = getElement("pic", true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
291 this.buttons1Div = getElement("buttons", true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
292 this.buttons2Div = getElement("options", true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
293 /* if (this.scalerImg == null && this.scalerDiv) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
294 // in N4 pic is in the scaler layer |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
295 this.scalerImg = this.scalerDiv.document.images[0]; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
296 } */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
297 if ((!this.scalerImg)||(!this.scalerDiv)) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
298 alert("Sorry, digilib doesn't work here!"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
299 return false; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
300 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
301 // fix fixed menus |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
302 var ms1 = getElementSize(this.buttons1Div); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
303 var ms2 = getElementSize(this.buttons2Div); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
304 var maxh = (ms1.height > ms2.height) ? ms1.height : ms2.height; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
305 var wins = getWinSize(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
306 if ((wins.height <= maxh) || browserType.isIE) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
307 // unlock fixed menus to absolute |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
308 this.buttons1Div.style.position = "absolute"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
309 this.buttons2Div.style.position = "absolute"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
310 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
311 this.setScalerImage(); // setzt auch onImgLoad |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
312 this.setBirdImage(); // l?dt das Bird's Eye Bild |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
313 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
314 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
315 Digilib.prototype.setScalerImage = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
316 // set the scaler image source (needs the browser size) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
317 var picsize = bestPicSize(this.scalerDiv); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
318 var menusize = getElementSize(this.buttons1Div); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
319 // subtract menu width |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
320 picsize.width -= menusize.width; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
321 picsize.height -= this.INSET; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
322 // compose Scaler URL |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
323 var src = "../servlet/Scaler?" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
324 + this.params.getAll(this.params.PARAM_ALL & ~(this.params.PARAM_MARK | this.params.PARAM_PAGES)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
325 if (this.opts.get('fitwidth')) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
326 src += "&dw=" + picsize.width; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
327 } else if (this.opts.get('fitheight')) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
328 src += "&dh=" + picsize.height; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
329 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
330 src += "&dw=" + picsize.width + "&dh=" + picsize.height; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
331 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
332 // debug(src); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
333 this.scalerImg.onload = onImgLoad; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
334 this.scalerImg.src = src; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
335 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
336 var digilib = this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
337 // this is a local callback function that can use the current scope |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
338 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
339 function onImgLoad() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
340 if (! digilib) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
341 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
342 // make sure the image is loaded so we know its size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
343 /* this test seems to have problems sometimes :-( |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
344 if (defined(digilib.scalerImg.complete) && !digilib.scalerImg.complete) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
345 alert("ERROR: the image seems not to be complete in onImgLoad!?"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
346 } */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
347 digilib.trafo = digilib.parseTrafo(digilib.scalerImg); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
348 // display marks |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
349 digilib.renderMarks(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
350 digilib.showBirdDiv(isBirdDivVisible); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
351 digilib.showArrows(); // show arrow overlays for zoom navigation |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
352 //digilib.moveCenter(true); // click to move point to center |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
353 // new Slider("sizes", 1, 5, 2); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
354 focus(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
355 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
356 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
357 Digilib.prototype.renderMarks = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
358 // make sure the image is loaded so we know its size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
359 if (!this.trafo) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
360 alert("ERROR: trafo missing, cannot render marks!"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
361 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
362 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
363 // debugProps(dlArea, "dlArea"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
364 for (var i = 0; i < this.marks.length; i++) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
365 var div = getElement("mark" + i, true) || createMarkDiv(i); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
366 var mark = this.marks[i]; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
367 // debugProps(mark, "mark"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
368 if (this.area.containsPosition(mark)) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
369 var mpos = this.trafo.transform(mark); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
370 // debugProps(mark, "mpos"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
371 // better not hide the marked spot (MR) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
372 // suboptimal to place -5 pixels and not half size of mark-image |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
373 // mpos.x = mpos.x -5; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
374 // mpos.y = mpos.y -5; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
375 moveElement(div, mpos); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
376 showElement(div, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
377 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
378 // hide the other marks |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
379 showElement(div, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
380 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
381 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
382 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
383 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
384 Digilib.prototype.display = function(detail, moDetail) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
385 // redisplay the page |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
386 var queryString = this.params.getAll(detail, moDetail); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
387 location.href |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
388 = location.protocol + "//" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
389 + location.host |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
390 + location.pathname |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
391 + "?" + queryString; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
392 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
393 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
394 /* ********************************************** |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
395 * interactive digilib functions |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
396 * ******************************************** */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
397 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
398 Digilib.prototype.setMark = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
399 // add a mark where clicked |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
400 window.focus(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
401 this.moveCenter(false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
402 // start event capturing |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
403 registerEvent("mousedown", this.scalerDiv, markEvent); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
404 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
405 // our own reference to this for the local function |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
406 var digilib = this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
407 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
408 function markEvent(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
409 // event handler adding a new mark |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
410 unregisterEvent("mousedown", digilib.scalerDiv, markEvent); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
411 digilib.marks.addEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
412 digilib.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
413 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
414 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
415 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
416 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
417 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
418 Digilib.prototype.removeMark = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
419 // remove the last mark |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
420 this.marks.pop(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
421 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
422 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
423 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
424 Digilib.prototype.zoomArea = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
425 var pt1, pt2; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
426 var zoomdiv = getElement("zoom"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
427 var overlay = getElement("overlay"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
428 // use overlay div to avoid <img> mousemove problems |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
429 var picRect = getElementRect(this.scalerImg); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
430 // FIX ME: is there a way to query the border width from CSS info? |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
431 // rect.x -= 2; // account for overlay borders |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
432 // rect.y -= 2; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
433 moveElement(overlay, picRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
434 showElement(overlay, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
435 // start event capturing |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
436 registerEvent("mousedown", overlay, zoomStart); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
437 registerEvent("mousedown", this.scalerImg, zoomStart); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
438 window.focus(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
439 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
440 // our own reference to "this" for the local functions |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
441 var _this = this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
442 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
443 // mousedown handler: start moving |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
444 function zoomStart(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
445 pt1 = evtPosition(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
446 unregisterEvent("mousedown", overlay, zoomStart); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
447 unregisterEvent("mousedown", _this.scalerImg, zoomStart); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
448 // setup and show zoom div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
449 moveElement(zoomdiv, Rectangle(pt1.x, pt1.y, 0, 0)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
450 showElement(zoomdiv, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
451 // register events |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
452 registerEvent("mousemove", document, zoomMove); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
453 registerEvent("mouseup", document, zoomEnd); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
454 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
455 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
456 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
457 // mouseup handler: end moving |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
458 function zoomEnd(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
459 pt2 = evtPosition(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
460 // assume a click if the area is too small (up to 3 x 3 pixel) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
461 var clickRect = new Rectangle(pt1, pt2); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
462 clickRect.normalize(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
463 if (clickRect.getArea() <= _this.MIN_AREA_SIZE) return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
464 // hide zoom div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
465 showElement(zoomdiv, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
466 showElement(overlay, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
467 // unregister events |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
468 unregisterEvent("mousemove", document, zoomMove); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
469 unregisterEvent("mouseup", document, zoomMove); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
470 // clip and transform |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
471 clickRect.clipTo(picRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
472 var area = _this.trafo.invtransform(clickRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
473 _this.setParamFromArea(area); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
474 // zoomed is always fit |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
475 _this.params.set("ws", 1); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
476 _this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
477 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
478 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
479 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
480 // mouse move handler |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
481 function zoomMove(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
482 pt2 = evtPosition(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
483 var rect = new Rectangle(pt1, pt2); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
484 rect.normalize(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
485 rect.clipTo(picRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
486 // update zoom div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
487 moveElement(zoomdiv, rect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
488 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
489 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
490 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
491 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
492 Digilib.prototype.zoomBy = function(factor) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
493 // zooms by the given factor |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
494 var newarea = this.area.copy(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
495 newarea.width /= factor; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
496 newarea.height /= factor; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
497 newarea.x -= 0.5 * (newarea.width - this.area.width); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
498 newarea.y -= 0.5 * (newarea.height - this.area.height); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
499 newarea = this.MAX_AREA.fit(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
500 this.setParamFromArea(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
501 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
502 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
503 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
504 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
505 Digilib.prototype.zoomFullpage = function(fit) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
506 // zooms out to show the whole image |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
507 this.params.set("wx", 0.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
508 this.params.set("wy", 0.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
509 this.params.set("ww", 1.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
510 this.params.set("wh", 1.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
511 if (fit == "width") { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
512 this.opts.set('fitwidth'); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
513 } else if (fit == "height") { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
514 this.opts.set('fitheight'); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
515 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
516 this.opts.reset('fitwidth'); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
517 this.opts.reset('fitheight'); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
518 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
519 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
520 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
521 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
522 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
523 Digilib.prototype.moveCenter = function(on) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
524 // move visible area so that it's centered around the clicked point |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
525 if (this.isFullArea()) return; // nothing to do |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
526 // starting event capture |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
527 if (on) registerEvent("mousedown", this.scalerImg, moveCenterEvent); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
528 else unregisterEvent("mousedown", this.scalerImg, moveCenterEvent); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
529 window.focus(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
530 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
531 // our own reference to this for the local function |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
532 var digilib = this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
533 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
534 function moveCenterEvent(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
535 // move to handler |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
536 var pt = digilib.trafo.invtransform(evtPosition(evt)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
537 var newarea = digilib.area.copy(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
538 newarea.setCenter(pt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
539 newarea.stayInside(this.MAX_AREA); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
540 // newarea = dlMaxArea.fit(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
541 // debugProps(newarea, "newarea"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
542 // debugProps(dlArea, "dlArea"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
543 if (newarea.equals(digilib.area)) return; // keep event handler |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
544 unregisterEvent("mousedown", digilib.scalerImg, moveCenterEvent); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
545 // set parameters |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
546 digilib.setParamFromArea(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
547 digilib.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
548 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
549 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
550 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
551 Digilib.prototype.isFullArea = function(area) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
552 if (!area) area = this.area; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
553 return (area.width == 1.0) && (area.height == 1.0); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
554 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
555 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
556 Digilib.prototype.canMove = function(movx, movy) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
557 if (this.isFullArea()) return false; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
558 var x2 = this.area.x + this.area.width; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
559 var y2 = this.area.y + this.area.height; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
560 // debugProps(dlArea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
561 return ((movx < 0) && (this.area.x > 0)) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
562 || ((movx > 0) && (x2 < 1.0)) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
563 || ((movy < 0) && (this.area.y > 0)) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
564 || ((movy > 0) && (y2 < 1.0)) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
565 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
566 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
567 Digilib.prototype.moveBy = function(movx, movy) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
568 // move visible area by movx and movy (in units of ww, wh) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
569 if (!this.canMove(movx, movy)) return; // nothing to do |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
570 var newarea = this.area.copy(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
571 newarea.x += parseFloat(movx)*this.area.width; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
572 newarea.y += parseFloat(movy)*this.area.height; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
573 newarea = this.MAX_AREA.fit(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
574 // set parameters |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
575 this.setParamFromArea(newarea); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
576 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
577 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
578 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
579 Digilib.prototype.getRef = function(baseUrl) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
580 // returns a reference to the current digilib set |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
581 if (!baseUrl) baseUrl |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
582 = location.protocol |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
583 + "//" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
584 + location.host |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
585 + location.pathname; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
586 var hyperlinkRef = baseUrl; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
587 with (this.params) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
588 // all without ddpi, pt |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
589 var ps = getAll(PARAM_ALL & ~(PARAM_DPI | PARAM_PAGES | PARAM_CLIENT)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
590 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
591 if (ps.length > 0) hyperlinkRef += "?" + ps; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
592 return hyperlinkRef; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
593 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
594 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
595 Digilib.prototype.getRefWin = function(type, msg) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
596 // shows an alert with a reference to the current digilib set |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
597 if (! msg) msg = "URL reference to the current view"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
598 prompt(msg, this.getRef()); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
599 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
600 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
601 Digilib.prototype.getQuality = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
602 // returns the current q setting |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
603 for (var i = 0; i < 3; i++) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
604 if (this.flags.get("q"+i)) return i; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
605 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
606 return 1 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
607 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
608 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
609 Digilib.prototype.setQuality = function(qual) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
610 // set the image quality |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
611 if ((qual < 0)||(qual > 2)) return alert("Quality setting not supported"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
612 for (var i = 0; i < 3; i++) this.flags.reset("q" + i); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
613 this.flags.set("q" + qual); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
614 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
615 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
616 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
617 Digilib.prototype.setQualityWin = function(msg) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
618 // dialog for setting quality |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
619 if (! msg) msg = "Quality (0..2)"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
620 var q = this.getQuality(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
621 var newq = window.prompt(msg, q); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
622 if (newq) this.setQuality(newq); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
623 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
624 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
625 Digilib.prototype.mirror = function(dir) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
626 // mirror the image horizontally or vertically |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
627 if (dir == "h") { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
628 this.flags.toggle("hmir"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
629 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
630 this.flags.toggle("vmir"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
631 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
632 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
633 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
634 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
635 Digilib.prototype.gotoPage = function(gopage, keep) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
636 // goto given page nr (+/-: relative) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
637 var oldpn = parseInt(this.params.get("pn")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
638 // set with relative=true uses the sign |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
639 this.params.set("pn", gopage, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
640 // now check the outcome |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
641 var pn = parseInt(this.params.get("pn")); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
642 if (pn < 1) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
643 alert("No such page! (Page number too low)"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
644 this.params.set("pn", oldpn); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
645 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
646 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
647 if (this.params.isSet("pt")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
648 pt = parseInt(this.params.get("pt")) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
649 if (pn > pt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
650 alert("No such page! (Page number too high)"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
651 this.params.set("pn", oldpn); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
652 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
653 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
654 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
655 if (keep) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
656 this.display(this.params.PARAM_ALL & ~this.params.PARAM_MARK); // all, no mark |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
657 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
658 this.display(this.params.PARAM_FILE | this.params.PARAM_MODE | this.params.PARAM_PAGES, this.params.MODE_QUAL | this.params.MODE_OTHER); // fn, pn, ws, mo + pt |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
659 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
660 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
661 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
662 Digilib.prototype.gotoPageWin = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
663 // dialog to ask for new page nr |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
664 var pn = this.params.get("pn"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
665 var gopage = window.prompt("Go to page", pn); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
666 if (gopage) this.gotoPage(gopage); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
667 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
668 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
669 Digilib.prototype.setParamWin = function(param, text, relative) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
670 // dialog to ask for new parameter value |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
671 var val = this.params.get(param); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
672 var newval = window.prompt(text, val); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
673 if (newval) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
674 this.params.set(param, newval, relative); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
675 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
676 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
677 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
678 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
679 Digilib.prototype.showOptions = function(show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
680 // show or hide option div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
681 var elem = getElement("dloptions"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
682 showElement(elem, show); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
683 // FIX ME: get rid of the dotted line around the buttons when focused |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
684 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
685 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
686 Digilib.prototype.showAboutDiv = function(show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
687 // show or hide "about" div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
688 var elem = getElement("about"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
689 if (elem == null) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
690 if (show) alert("About Digilib - dialog missing in HTML code!" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
691 + "\nDigilib Version: " + digilibVersion |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
692 + "\JSP Version: " + jspVersion |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
693 + "\ndlLib Version: " + dllibVersion |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
694 + "\nbaseLib Version: " + baseLibVersion); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
695 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
696 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
697 if (show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
698 getElement("digilib-version").innerHTML = "Digilib Version: " + digilibVersion; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
699 getElement("jsp-version").innerHTML = "JSP Version: " + jspVersion; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
700 getElement("baselib-version").innerHTML = "baseLib Version: " + baseLibVersion; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
701 getElement("dllib-version").innerHTML = "dlLib Version: " + dllibVersion; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
702 var aboutRect = getElementRect(elem); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
703 aboutRect.setCenter(getWinRect().getCenter()); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
704 moveElement(elem, aboutRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
705 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
706 showElement(elem, show); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
707 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
708 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
709 Digilib.prototype.setBirdImage = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
710 var img = getElement("bird-image"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
711 var src = "../servlet/Scaler?" |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
712 + this.params.getAll(this.params.PARAM_FILE) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
713 + "&dw=" + this.BIRD_MAXX |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
714 + "&dh=" + this.BIRD_MAXY; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
715 img.src = src; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
716 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
717 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
718 Digilib.prototype.showBirdDiv = function(show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
719 // show or hide "bird's eye" div |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
720 var startPos; // anchor for dragging |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
721 var newRect; // position after drag |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
722 var birdImg = getElement("bird-image"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
723 var birdArea = getElement("bird-area"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
724 var overlay = getElement("overlay"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
725 showElement(birdImg, show); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
726 // dont show selector if area has full size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
727 if (!show || this.isFullArea()) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
728 // hide area |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
729 showElement(birdArea, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
730 showElement(overlay, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
731 return; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
732 }; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
733 var birdImgRect = getElementRect(birdImg); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
734 var area = this.area; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
735 if (this.flags.get("osize") || this.flags.get("clip")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
736 // in original-size and pixel-by-pixel mode the area size is not valid |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
737 var birdAreaRect = new Rectangle( |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
738 birdImgRect.x + birdImgRect.width * area.x, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
739 birdImgRect.y + birdImgRect.height * area.y, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
740 5, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
741 5); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
742 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
743 // scale area down to img size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
744 var birdAreaRect = new Rectangle( |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
745 // what about borders ?? |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
746 birdImgRect.x + birdImgRect.width * area.x, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
747 birdImgRect.y + birdImgRect.height * area.y, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
748 birdImgRect.width * area.width, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
749 birdImgRect.height * area.height); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
750 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
751 moveElement(birdArea, birdAreaRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
752 showElement(birdArea, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
753 moveElement(overlay, birdImgRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
754 showElement(overlay, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
755 registerEvent("mousedown", overlay, birdAreaStartDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
756 registerEvent("mousedown", birdImg, birdAreaStartDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
757 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
758 // our own reference to this for local functions |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
759 var digilib = this; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
760 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
761 function birdAreaStartDrag(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
762 // mousedown handler: start drag |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
763 startPos = evtPosition(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
764 unregisterEvent("mousedown", overlay, birdAreaStartDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
765 unregisterEvent("mousedown", birdImg, birdAreaStartDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
766 registerEvent("mousemove", document, birdAreaMove); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
767 registerEvent("mouseup", document, birdAreaEndDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
768 // debugProps(getElementRect(bird)) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
769 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
770 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
771 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
772 function birdAreaMove(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
773 // mousemove handler: drag |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
774 var pos = evtPosition(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
775 var dx = pos.x - startPos.x; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
776 var dy = pos.y - startPos.y; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
777 // move birdArea div, keeping size |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
778 newRect = new Rectangle( |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
779 birdAreaRect.x + dx, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
780 birdAreaRect.y + dy, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
781 birdAreaRect.width, |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
782 birdAreaRect.height); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
783 // stay within image |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
784 newRect.stayInside(birdImgRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
785 moveElement(birdArea, newRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
786 showElement(birdArea, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
787 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
788 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
789 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
790 function birdAreaEndDrag(evt) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
791 // mouseup handler: reload page |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
792 unregisterEvent("mousemove", document, birdAreaMove); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
793 unregisterEvent("mouseup", document, birdAreaEndDrag); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
794 showElement(overlay, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
795 if (newRect == null) { // no movement happened |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
796 startPos = birdAreaRect.getCenter(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
797 birdAreaMove(evt); // set center to click position |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
798 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
799 digilib.params.set("wx", cropFloat((newRect.x - birdImgRect.x) / birdImgRect.width)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
800 digilib.params.set("wy", cropFloat((newRect.y - birdImgRect.y) / birdImgRect.height)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
801 // zoomed is always fit |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
802 digilib.params.set("ws", 1); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
803 digilib.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
804 return stopEvent(evt); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
805 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
806 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
807 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
808 Digilib.prototype.showArrow = function(name, rect, show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
809 var arrow = getElement(name); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
810 moveElement(arrow, rect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
811 showElement(arrow, show); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
812 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
813 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
814 Digilib.prototype.showArrows = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
815 // show the 4 arrow bars on top of scaler img according to current dlArea |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
816 var r = getElementRect(this.scalerImg); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
817 this.showArrow('up', |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
818 new Rectangle(r.x, r.y, r.width, this.ARROW_WIDTH), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
819 this.canMove(0, -1) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
820 ); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
821 this.showArrow('down', |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
822 new Rectangle(r.x, r.y + r.height - this.ARROW_WIDTH, r.width, this.ARROW_WIDTH), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
823 this.canMove(0, 1) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
824 ); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
825 this.showArrow('left', |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
826 new Rectangle(r.x, r.y, this.ARROW_WIDTH, r.height), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
827 this.canMove(-1, 0) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
828 ); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
829 this.showArrow('right', |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
830 new Rectangle(r.x + r.width - this.ARROW_WIDTH, r.y, this.ARROW_WIDTH, r.height), |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
831 this.canMove(1, 0) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
832 ); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
833 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
834 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
835 Digilib.prototype.calibrate = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
836 // calibrate screen resolution |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
837 var calDiv = getElement("calibration"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
838 var calRect = getElementRect(calDiv); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
839 moveCenter(false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
840 var wins = getWinSize(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
841 calRect.setCenter(new Position(wins.width / 2, wins.height / 2)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
842 moveElement(calDiv, calRect); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
843 showElement(calDiv, true); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
844 var cm = window.prompt("The length of the scale on your screen in centimeter:"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
845 if (cm) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
846 var dpi = calRect.width / parseFloat(cm) * 2.54; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
847 this.params.set("ddpi", cropFloat(dpi)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
848 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
849 showElement(calDiv, false); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
850 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
851 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
852 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
853 Digilib.prototype.setScale = function(scale) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
854 // sets original-size, pixel-by-pixel or fit-to-screen scale type |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
855 if (scale == "pixel") { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
856 // pixel by pixel |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
857 this.flags.set("clip"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
858 this.flags.reset("osize"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
859 this.flags.reset("fit"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
860 } else if (scale == "original") { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
861 // original size -- needs calibrated screen |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
862 if (!this.params.isSet("ddpi")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
863 var dpi = cookie.get("ddpi"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
864 if (dpi == null) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
865 alert("Your screen has not yet been calibrated - using default value of 72 dpi"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
866 dpi = 72; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
867 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
868 this.params.set("ddpi", dpi); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
869 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
870 this.flags.set("osize"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
871 this.flags.reset("clip"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
872 this.flags.reset("fit"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
873 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
874 // scale to screen size (default) |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
875 this.flags.reset("clip"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
876 this.flags.reset("osize"); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
877 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
878 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
879 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
880 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
881 Digilib.prototype.getScale = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
882 // returns scale type |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
883 if (this.flags.get("clip")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
884 return "pixel"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
885 } else if (this.flags.get("osize")) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
886 return "original"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
887 } else { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
888 return "fit"; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
889 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
890 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
891 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
892 Digilib.prototype.pageWidth = function() { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
893 this.zoomFullpage('width'); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
894 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
895 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
896 Digilib.prototype.setSize = function(factor) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
897 this.params.set("ws", factor); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
898 this.display(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
899 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
900 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
901 Digilib.prototype.showMenu = function(menuId, buttonId, show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
902 var menu = getElement(menuId); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
903 if (show) { |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
904 // align right side of menu with button |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
905 var buttonPos = getElementPosition(getElement(buttonId)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
906 var menusize = getElementSize(menu); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
907 moveElement(menu, new Position(buttonPos.x - menusize.width - 3, buttonPos.y)); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
908 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
909 showElement(menu, show); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
910 } |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
911 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
912 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
913 /******************************** |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
914 * global variables |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
915 ********************************/ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
916 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
917 var dl = new Digilib(); |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
918 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
919 /* old parameter function compatibility stuff */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
920 function newParameter(a,b,c) {return dl.params.define(a,b,c)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
921 function resetParameter(a) {return dl.params.reset(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
922 function deleteParameter(a) {return dl.params.remove(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
923 function getParameter(a) {return dl.params.get(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
924 function setParameter(a,b,c) {return dl.params.set(a,b,c)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
925 function hasParameter(a) {return dl.params.isSet(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
926 function getAllParameters(a) {return dl.params.getAll(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
927 getQueryString = getAllParameters; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
928 function parseParameters(a) {return dl.params.parse(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
929 function getAllMarks() {return dl.marks.getAll()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
930 getMarksQueryString = getAllMarks; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
931 function addMark(evt) {return dl.marks.addEvent(evt)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
932 function deleteMark() {return dl.marks.pop()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
933 function deleteAllMarks() {return dl.marks = new Marks()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
934 function hasFlag(mode) {return dl.flags.get(mode)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
935 function addFlag(mode) {return dl.flags.set(mode)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
936 function removeFlag(mode) {return dl.flags.reset(mode)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
937 function toggleFlag(mode) {return dl.flags.toggle(mode)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
938 function getAllFlags() {return dl.flags.getAll()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
939 /* old digilib function compatibility */ |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
940 function setDLParam(e, s, relative) {dl.setDLParam(e, s, relative)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
941 function display(detail, moDetail) {dl.display(detail, moDetail)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
942 function setMark(reload) {dl.setMark(reload)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
943 function removeMark(reload) {dl.removeMark(reload)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
944 function zoomArea() {dl.zoomArea()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
945 function zoomBy(factor) {dl.zoomBy(factor)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
946 function zoomFullpage(a) {dl.zoomFullpage(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
947 function moveCenter(on) {dl.moveCenter(on)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
948 function isFullArea(area) {dl.isFullArea(area)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
949 function canMove(movx, movy) {dl.canMove(movx, movy)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
950 function moveBy(movx, movy) {dl.moveBy(movx, movy)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
951 function getRef(baseURL) {dl.getRef(baseURL)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
952 function getRefWin(type, msg) {dl.getRefWin(type, msg)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
953 function getQuality() {dl.getQuality()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
954 function setQuality(qual) {dl.setQuality(qual)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
955 function setQualityWin(msg) {dl.setQualityWin(msg)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
956 function mirror(dir) {dl.mirror(dir)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
957 function gotoPage(gopage, keep) {dl.gotoPage(gopage, keep)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
958 function gotoPageWin() {dl.gotoPageWin()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
959 function setParamWin(param, text, relative) {dl.setParamWin(param, text, relative)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
960 function showOptions(show) {dl.showOptions(show)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
961 function showBirdDiv(show) {dl.showBirdDiv(show)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
962 function showAboutDiv(show) {dl.showAboutDiv(show)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
963 function calibrate(direction) {dl.calibrate(direction)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
964 function setScale(a) {dl.setScale(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
965 function getScale(a) {dl.getScale(a)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
966 function originalSize(on) {dl.originalSize(on)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
967 function pixelByPixel(on) {dl.pixelByPixel(on)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
968 function pageWidth() {dl.pageWidth()}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
969 function setSize(factor) {dl.setSize(factor)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
970 function showMenu(a,b,c) {dl.showMenu(a,b,c)}; |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
971 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
972 |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
973 // :tabSize=4:indentSize=4:noTabs=true: |
351c5924b7a6
Fixed a bug when the clicked zoom area was too small
hertzhaft
parents:
483
diff
changeset
|
974 |