changeset 445:6154dfc67615

pageWidth (not yet working in IE)
author hertzhaft
date Fri, 13 Jan 2006 12:31:00 +0100
parents 5827dd2d3ccc
children 323e7d7dc378
files client/digitallibrary/greyskin/diginew.css client/digitallibrary/greyskin/diginew.jsp client/digitallibrary/greyskin/dllib.js
diffstat 3 files changed, 38 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/greyskin/diginew.css	Fri Jan 13 12:29:03 2006 +0100
+++ b/client/digitallibrary/greyskin/diginew.css	Fri Jan 13 12:31:00 2006 +0100
@@ -231,7 +231,7 @@
 	color: lightgreen;
 	border: 1px dotted black;
 	background-color: transparent;
-	/*visibility: hidden;*/
+	visibility: hidden;
 	}
 
 div#debug p.debug, h1 {
--- a/client/digitallibrary/greyskin/diginew.jsp	Fri Jan 13 12:29:03 2006 +0100
+++ b/client/digitallibrary/greyskin/diginew.jsp	Fri Jan 13 12:31:00 2006 +0100
@@ -59,7 +59,7 @@
 	var dlTarget = window.name;
 	var baseUrl = '<%= dlRequest.getAsString("base.url") %>';
 	var toolbarEnabledURL = window.location.href;
-	var timeOut;
+	var waited = 0;
 
 	function toggleOptionDiv() {
 		isOptionDivVisible = !isOptionDivVisible;
@@ -122,19 +122,29 @@
 		if (hasParameter("rgb"))
 			setOnImage("rgb", "rgb-on.png", getParameter("rgb"));
 		}
-		
-	// initialize image; called by body.onload
+	function onImgLoad() {
+		// make sure the image is loaded so we know its size
+		if (defined(scalerImg.complete) && !scalerImg.complete && !browserType.isN4 ) {
+			setTimeout("onImgLoad()", 100);
+			waited += 100;
+			return;
+			}
+		reflectImageStatus();	// adjust icons
+		showOptions(isOptionDivVisible);
+		showBirdDiv(isBirdDivVisible);
+		showArrows();		// show arrow overlays for zoom navigation
+		moveCenter(true);	// click to move point to center
+		// new Slider("sizes", 1, 5, 2);
+		}
+
+	// initialize digilib; called by body.onload
 	function onBodyLoad() {
 		document.id = 'digilib';
 		initParameters();	// load default values and detail
 		dl_param_init();	// parse parameter values
 		loadScalerImage();	// ruft auch dl_init() / initScaler auf
 		loadBirdImage();	// lädt das Bird's Eye Bild
-		reflectImageStatus();	// adjust icons
-		showOptions(isOptionDivVisible);
-		showBirdDiv(isBirdDivVisible);
-		showArrows();		// show arrow overlays for zoom navigation
-		moveCenter(true);	// click to move point to center
+		onImgLoad();
 		}
 
 	function onBodyUnload() {
@@ -200,6 +210,10 @@
 	<p><a href="javascript:resize(1.41)">1.41 x</a></p>
 	<p><a href="javascript:resize(2)">2 x</a></p>
 	<p><a href="javascript:resize(3)">3 x</a></p>
+	<div id="sizes-bar">
+		<div id="sizes-slider"></div>
+	</div>
+	<p id="sizes-value"></p>
  </div>
 
  <!-- the buttons -->
--- a/client/digitallibrary/greyskin/dllib.js	Fri Jan 13 12:29:03 2006 +0100
+++ b/client/digitallibrary/greyskin/dllib.js	Fri Jan 13 12:31:00 2006 +0100
@@ -39,6 +39,9 @@
 scalerDiv = null;
 scalerImg = null;
 
+// default inset (for scalerImg relativ to scalerDiv 
+INSET = 40; // because of scrollbars of main window and scaler [Firefox bug?]
+
 // flags for parameter sets
 PARAM_FILE = 1;
 PARAM_MODE = 2;
@@ -945,6 +948,18 @@
     else removeFlag("clip");
 }
 
+function pageWidth() {
+    var divSize = getElementSize(scalerDiv);
+    divSize.width -= INSET; // allow for scrollbars [Firefox bug?]
+    var imgSize = getElementSize(scalerImg);
+    if (imgSize.width < divSize.width) {
+        setParameter("ws", cropFloat(divSize.width / imgSize.width));
+        display(PARAM_ALL & ~PARAM_DIM); // no zoom
+        };
+    // TODO: how to calculate correct width if zoom is on? (plus size?)
+
+}
+
 function resize(factor) {
     setParameter("ws", factor);
     showSizeMenu(false);