changeset 1019:287e2d2d2ae8

fix flicker in Firefox by leaving scaler background visible. add setSize and setRGB actions. disabled rotation slider for now (needs excact numerical input option).
author robcast
date Mon, 20 Feb 2012 22:23:07 +0100
parents 7f8aaae89f9b
children 0eedb4a5b674
files webapp/src/main/webapp/jquery/jquery.digilib.buttons.js webapp/src/main/webapp/jquery/jquery.digilib.js
diffstat 2 files changed, 49 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Mon Feb 20 02:35:22 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Mon Feb 20 22:23:07 2012 +0100
@@ -78,8 +78,8 @@
             icon : "mirror-vertical.png"
             },
         rot : {
-            onclick : "sliderRotate",
-            // onclick : ["slider", "rot"],
+            //onclick : "sliderRotate",
+            onclick : ["slider", "rot"],
             tooltip : "rotate image",
             icon : "rotate.png"
             },
@@ -96,7 +96,7 @@
             icon : "contrast.png"
             },
         rgb : {
-            onclick : "javascript:setParamWin('rgb', '...')",
+            onclick : "setRGB",
             //onclick : ["multislider", "rgb"],
             tooltip : "set rgb values",
             icon : "rgb.png"
@@ -107,7 +107,7 @@
             icon : "quality.png"
             },
         size : {
-            onclick : "javascript:toggleSizeMenu()",
+            onclick : "setSize",
             tooltip : "set page size",
             icon : "size.png"
             },
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Mon Feb 20 02:35:22 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Mon Feb 20 22:23:07 2012 +0100
@@ -38,7 +38,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.1.5b2',
+        'version' : 'jquery.digilib.js 2.1.6a1',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
@@ -409,6 +409,32 @@
             redisplay(data);
         },
 
+        /** change rgb contrast and brightness
+         * 
+         * @param data
+         * @param rgbm
+         * @param rgba
+         */
+        setRGB : function (data, rgbm, rgba) {
+            var oldRgbm = data.settings.rgbm;
+            var oldRgba = data.settings.rgba;
+            if (rgbm == null && rgba == null) {
+                var rgb = window.prompt("RGBm, RGBa (m_r/m_g/m_b, a_r/a_g/a_b)", oldRgbm+', '+oldRgba);
+                if (rgb != null) {
+                    rgbs = rgb.split(/,\s*/);
+                    if (rgbs.length == 2) {
+                        data.settings.rgbm = rgbs[0];
+                        data.settings.rgba = rgbs[1];
+                        redisplay(data);
+                    }
+                }
+            } else {
+                if (rgbm != null) data.settings.rgbm = rgbm;
+                if (rgba != null) data.settings.rgba = rgba;
+                redisplay(data);                
+            }
+        },
+
         /** reset image parameters to defaults 
          * TODO: improve this!
          * 
@@ -494,6 +520,23 @@
             }
         },
 
+        /** set image size
+         * 
+         * @param data
+         * @param size
+         */
+        setSize : function (data, size) {
+            var olds = data.settings.ws;
+            if (size == null) {
+                size = window.prompt("Image size (1=screen size)", olds);
+            }
+            size = parseFloat(size);
+            if (size > 0) {
+                data.settings.ws = size;
+                redisplay(data);
+            }
+        },
+
         /** calibrate (set client screen dpi)
          * 
          * @param data
@@ -1130,7 +1173,7 @@
             imgRect.getSize().adjustDiv($scaler);
             // show image in case it was hidden (for example in zoomDrag)
             $img.css('visibility', 'visible');
-            $scaler.css({'opacity' : '1', 'background' : 'transparent'});
+            $scaler.css({'opacity' : '1'});
             data.hasPreviewBg = false;
             // update display (render marks, etc.)
             updateDisplay(data);