changeset 663:9791a2cec863 jquery

rotate, contrast, and brightness
author robcast
date Sun, 23 Jan 2011 00:26:07 +0100
parents 6a03dbd30e4f
children d5a5ee4cbf04
files client/digitallibrary/jquery/jquery.digilib.js
diffstat 1 files changed, 37 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.js	Sat Jan 22 23:34:48 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Sun Jan 23 00:26:07 2011 +0100
@@ -95,17 +95,17 @@
             img : "mirror-vertical.png"
             },
         rot : {
-            onclick : "javascript:setParamWin('rot', 'Rotate (0..360) clockwise')",
+            onclick : "rotate",
             tooltip : "rotate image",
             img : "rotate.png"
             },
         brgt : {
-            onclick : "javascript:setParamWin('brgt', 'Brightness (-255..255)')",
+            onclick : "brightness",
             tooltip : "set brightness",
             img : "brightness.png"
             },
         cont : {
-            onclick : "javascript:setParamWin('cont', 'Contrast (0..8)')",
+            onclick : "contrast",
             tooltip : "set contrast",
             img : "contrast.png"
             },
@@ -374,7 +374,40 @@
                     }
                 }
             	redisplay(data);
+            },
+            
+            // rotate the image
+            rotate : function (data, angle) {
+                var rot = data.settings.rot;
+                if (angle == null) {
+                    angle = window.prompt("Rotation angle:", rot);
+                }
+                data.settings.rot = angle;
+                redisplay(data);
+            },
+            
+            // change brightness
+            brightness : function (data, factor) {
+                var brgt = data.settings.brgt;
+                if (factor == null) {
+                    factor = window.prompt("Brightness (-255..255)", brgt);
+                }
+                data.settings.brgt = factor;
+                redisplay(data);
+            },
+            
+            // change contrast
+            contrast : function (data, factor) {
+                var cont = data.settings.cont;
+                if (factor == null) {
+                    factor = window.prompt("Contrast (-8, 8)", cont);
+                }
+                data.settings.cont = factor;
+                redisplay(data);
             }
+            
+            
+            
 
     };
 
@@ -418,7 +451,7 @@
         var nx = false;
         for (i = 0; i < keys.length; ++i) {
             var key = keys[i];
-            if ((settings[key] != null) && ((defaults == null) || (settings[key] !== defaults[key]))) {
+            if ((settings[key] != null) && ((defaults == null) || (settings[key] != defaults[key]))) {
                 // first param gets no '&'
                 if (nx) {
                     paramString += '&';