web/data/cubicweb.image.js
branchstable
changeset 6010 9d40ee3d0551
parent 6004 d17d3b34bc12
child 6215 759cf097f5aa
--- a/web/data/cubicweb.image.js	Mon Jul 26 12:06:55 2010 +0200
+++ b/web/data/cubicweb.image.js	Mon Jul 26 12:06:58 2010 +0200
@@ -7,18 +7,22 @@
     var imgHSize = this.width();
     var maxHSize = $(window).width() - ($(document).width() - imgHSize);
     var imgVSize = this.height();
-    var maxVSize = $(window).height() - ($(document).height() - imgVSize);
+    // we don't mind if content in [content]footer moved out of the screen
+    var maxVSize = $(window).height() - ($(document).height() - imgVSize) + $('#footer').height() + $('#contentfooter').height();
     if (maxHSize > 0 && maxVSize > 0) {
 	// if image don't fit screen, set width or height so that
 	// browser keep img ratio, ensuring the other dimension will
 	// also fit the screen
-	if (imgHSize > maxHSize && ((maxHSize / maxVSize) * imgVSize) < maxVSize) {
+	if (imgHSize > maxHSize && ((imgVSize / imgHSize) * maxHSize) <= maxVSize) {
 	    this.css("width", maxHSize);
-	} else if (imgVSize > maxVSize && ((maxVSize / maxHSize) * imgHSize) < maxHSize) {
+	} else if (imgVSize > maxVSize && ((imgHSize / imgVSize) * maxVSize) <= maxHSize) {
 	    this.css("height", maxVSize);
-	} // else image already fit in screen, don't scale it up
+	}
+	else {
+	    // image already fit in screen, don't scale it up
+	}
     } else {
-	// XXX can't fit image, don't do anything
+	// can't fit image in, don't do anything
     }
 };