Skip to content

Commit

Permalink
if showAlpha is off, set currentAlpha back to 1 whenever we drag
Browse files Browse the repository at this point in the history
  • Loading branch information
owiber committed Dec 23, 2013
1 parent 28ab793 commit f8301b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@
draggable(slider, function (dragX, dragY) {
currentHue = parseFloat(dragY / slideHeight);
isEmpty = false;
if (!opts.showAlpha) {
currentAlpha = 1;
}
move();
}, dragStart, dragStop);

Expand Down Expand Up @@ -377,6 +380,9 @@
}

isEmpty = false;
if (!opts.showAlpha) {
currentAlpha = 1;
}

move();

Expand Down Expand Up @@ -661,7 +667,7 @@

// Get a format that alpha will be included in (hex and names ignore alpha)
var format = currentPreferredFormat;
if (currentAlpha < 1) {
if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
format = "rgb";
}
Expand Down

0 comments on commit f8301b7

Please sign in to comment.