Permalink
Browse files

Make fields extra work properly

  • Loading branch information...
1 parent 59e9b5e commit 77ddd84b5d47c9a4afc6637b2c8b3a96e221cf26 @bebraw committed Jul 11, 2012
Showing with 17 additions and 9 deletions.
  1. +8 −4 dist/colorjoe.js
  2. +1 −1 dist/colorjoe.min.js
  3. +7 −4 src/colorjoe.js
  4. +1 −0 src/extras.js
View
@@ -1072,6 +1072,7 @@ function fields(p, joe, o) {
var col = [cs];
elems.forEach(function(o) {col.push(o.e.input.value / fac);});
+ col.push(1); // alpha
chg = true;
joe.set(onecolor(col));
@@ -1312,13 +1313,16 @@ function setup(o) {
}
function getColor(c) {
- var ret = onecolor(c);
+ if(!isDefined(c)) return onecolor('black');
+ if(c.isColor) return c;
- if(ret) return ret;
+ var ret = onecolor(c);
- if(isDefined(c)) console.warn('Passed invalid color to colorjoe, using black instead');
+ if(ret) return ret;
- return onecolor('black');
+ if(isDefined(c)) console.warn('Passed invalid color to colorjoe, using black instead');
+
+ return onecolor('black');
}
function setupExtras(p, joe, extras) {
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -190,13 +190,16 @@ function setup(o) {
}
function getColor(c) {
- var ret = onecolor(c);
+ if(!isDefined(c)) return onecolor('black');
+ if(c.isColor) return c;
- if(ret) return ret;
+ var ret = onecolor(c);
- if(isDefined(c)) console.warn('Passed invalid color to colorjoe, using black instead');
+ if(ret) return ret;
- return onecolor('black');
+ if(isDefined(c)) console.warn('Passed invalid color to colorjoe, using black instead');
+
+ return onecolor('black');
}
function setupExtras(p, joe, extras) {
View
@@ -51,6 +51,7 @@ function fields(p, joe, o) {
var col = [cs];
elems.forEach(function(o) {col.push(o.e.input.value / fac);});
+ col.push(1); // alpha
chg = true;
joe.set(onecolor(col));

0 comments on commit 77ddd84

Please sign in to comment.