diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-26 19:10:56 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-26 19:10:56 -0400 |
| commit | 36b90395b85d6859dd78af9eb71c3df343e24841 (patch) | |
| tree | 397c0d016fb3cff78d159b6bfed9dcf618eebc6c | |
| parent | 2bf7351025b29d1bc8ec2e5792dcb0532c4deb95 (diff) | |
catch divide-by-zero error in xyz2hunterlab function
| -rw-r--r-- | public/assets/javascripts/ui/editor/LightControl.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/public/assets/javascripts/ui/editor/LightControl.js b/public/assets/javascripts/ui/editor/LightControl.js index b1c5b85..1bd660e 100644 --- a/public/assets/javascripts/ui/editor/LightControl.js +++ b/public/assets/javascripts/ui/editor/LightControl.js @@ -170,6 +170,7 @@ var LabColorPicker = function (parent, w, h) { var y = mix( norm(Lab[2], b_range[0], b_range[1]), 0, hh ) // move the cursor this.setLab(Lab) + console.log(rgba) return Lab } this.paint = function() { @@ -245,13 +246,11 @@ var LabColorPicker = function (parent, w, h) { } function xyz2hunterlab (XYZ) { var X = XYZ[0] - var Y = XYZ[1] + var Y = XYZ[1] || 1e-6 // otherwise divide-by-zero error when converting rgb(0,0,0) var Z = XYZ[2] var L = 10 * sqrt( Y ) var a = 17.5 * ( ( ( 1.02 * X ) - Y ) / sqrt( Y ) ) var b = 7 * ( ( Y - ( 0.847 * Z ) ) / sqrt( Y ) ) return [L,a,b] } - - // this.paint(val) } |
