Permalink
Browse files

Clamp slider values properly

  • Loading branch information...
1 parent fbdb686 commit 691aab18cd5b498fdf8098904e5a56d4949c0f31 @bebraw committed Jul 10, 2012
Showing with 15 additions and 7 deletions.
  1. +7 −3 dist/colorjoe.js
  2. +2 −2 dist/colorjoe.min.js
  3. +5 −2 src/colorjoe.js
  4. +1 −0 src/elemutils.js
View
@@ -1,4 +1,4 @@
-/*! colorjoe - v0.6.0 - 2012-07-09
+/*! colorjoe - v0.6.0 - 2012-07-10
* http://bebraw.github.com/colorjoe/
* Copyright (c) 2012 Juho Vepsäläinen; Licensed MIT */
@@ -993,6 +993,7 @@ ONECOLOR.installMethod('toAlpha', function (color) {
}
return {
+ clamp: clamp,
e: e,
div: div,
partial: partial,
@@ -1197,7 +1198,10 @@ function setup(o) {
});
function changeXY(p) {
- col = cbs.xy(col, p, xy, z);
+ col = cbs.xy(col, {
+ x: utils.clamp(p.x, 0, 1),
+ y: utils.clamp(p.y, 0, 1)
+ }, xy, z);
changed();
}
@@ -1212,7 +1216,7 @@ function setup(o) {
});
function changeZ(p) {
- col = cbs.z(col, p.y, xy, z);
+ col = cbs.z(col, utils.clamp(p.y, 0, 1), xy, z);
changed();
}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -90,7 +90,10 @@ function setup(o) {
});
function changeXY(p) {
- col = cbs.xy(col, p, xy, z);
+ col = cbs.xy(col, {
+ x: utils.clamp(p.x, 0, 1),
+ y: utils.clamp(p.y, 0, 1)
+ }, xy, z);
changed();
}
@@ -105,7 +108,7 @@ function setup(o) {
});
function changeZ(p) {
- col = cbs.z(col, p.y, xy, z);
+ col = cbs.z(col, utils.clamp(p.y, 0, 1), xy, z);
changed();
}
View
@@ -61,6 +61,7 @@
}
return {
+ clamp: clamp,
e: e,
div: div,
partial: partial,

0 comments on commit 691aab1

Please sign in to comment.