changeset 210:0a0a2936d779

Adjust image adjustment etc.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 22 Mar 2018 14:57:51 +0200
parents 671b7cfebf87
children dc11f61663c9
files basic.css mgallery.js mgallery.php
diffstat 3 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/basic.css	Thu Mar 22 13:41:36 2018 +0200
+++ b/basic.css	Thu Mar 22 14:57:51 2018 +0200
@@ -425,7 +425,8 @@
 
 	#pageImageCaption {
 		bottom: 0;
-		height: 2em;
+		height: 2.5em;
+		overflow: hidden;
 	}
 
 	#pageInfoFooter {
--- a/mgallery.js	Thu Mar 22 13:41:36 2018 +0200
+++ b/mgallery.js	Thu Mar 22 14:57:51 2018 +0200
@@ -116,26 +116,27 @@
 function mgalAdjustImageDo()
 {
   var eimg = document.getElementById("imageImage");
-  var win = mgalGetElementOrWindowSize("pageImageBox");
+  var ewin = mgalGetElementOrWindowSize("pageImageBox");
   var madj = 0.99;
-  if (eimg && win != null)
+  if (eimg && ewin != null)
   {
     if (eimg.width > eimg.height)
     {
       eimg.style.width = "100%";
       eimg.style.height = "auto";
-      if (eimg.height > win[1] * madj)
+      if (eimg.height > ewin[1] * madj)
       {
         eimg.style.width = "auto";
-        eimg.style.height = (win[1] * madj)+"px";
+        eimg.style.height = (ewin[1] * madj)+"px";
       }
     }
     else
     {
       eimg.style.width = "auto";
       eimg.style.height = "100%";
-      if (eimg.height > win[1] * madj)
-        eimg.style.height = (win[1] * madj)+"px";
+
+      if (eimg.height > ewin[1] * madj)
+        eimg.style.height = (ewin[1] * madj)+"px";
     }
   }
   adjustPID = -1;
--- a/mgallery.php	Thu Mar 22 13:41:36 2018 +0200
+++ b/mgallery.php	Thu Mar 22 14:57:51 2018 +0200
@@ -629,8 +629,9 @@
 mgalAddEvent("pageInfoButton", "click", mgalOpenInfo);
 mgalAddEvent("pageImageBox", "click", mgalCloseInfo);
 
-mgalAddEvent("imageImage", "load", mgalAdjustImageDo);
+mgalAddEvent("imageImage", "load", mgalAdjustImage);
 mgalAddEventOb("window", window, "resize", mgalAdjustImage);
+mgalAddEventOb("window", window, "load", mgalAdjustImage);
 mgalAddEventOb("document", document, "keypress", mgalProcessKeyPress);
 
 adjustPID = -1;