changeset 1079:9c2abceb05c5

brightness min- and max- values scale with contrast settings (not yet for rgb). fixed bug with dismissing the rgb sliders window.
author robcast
date Thu, 24 May 2012 14:35:43 +0200
parents ec1c3de5c70b
children dbd1cf7cd86a
files webapp/src/main/webapp/jquery/jquery.digilib.js webapp/src/main/webapp/jquery/jquery.digilib.sliders.js
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Wed May 23 17:25:04 2012 +0200
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Thu May 24 14:35:43 2012 +0200
@@ -38,7 +38,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.1.7a1',
+        'version' : 'jquery.digilib.js 2.1.7b1',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
--- a/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js	Wed May 23 17:25:04 2012 +0200
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js	Thu May 24 14:35:43 2012 +0200
@@ -23,7 +23,7 @@
             preview : false,
             min : 0,
             max : 360,
-            step : 0.1,
+            step : 5,
             start : 0
             },
         brgt : {
@@ -70,11 +70,15 @@
             },
         brgt : 0,
         cont : 0
-        }
+    };
 
     var actions = {
         // shows brightness slider
         sliderBrgt : function (data) {
+            // adjust min and max for contrast value (not nice to change sliderOptions)
+            var maxBrgt = Math.max(Math.round(255 * Math.pow(2, data.settings.cont)), 255);
+            sliderOptions.brgt.min = -maxBrgt;
+            sliderOptions.brgt.max = maxBrgt;
             var onChange = function($slider, val) {
                 colorVals['brgt'] = parseFloat(val);
                 updatePreview($slider);
@@ -122,6 +126,10 @@
         if ($slider == null) return;
         var cls = $slider.data('cls');
         var $preview = $slider.data('preview');
+        if ($preview == null) {
+            console.error("slider updatePreview without preview!");
+            return;
+        }
         var $td2 = $preview.find('table.'+cls+'preview td');
         // account for current brgt/cont/rgbm/rgba values
         var calcRGBValue = function (code, val) {