Skip to content

Commit

Permalink
fix #109
Browse files Browse the repository at this point in the history
  • Loading branch information
linx4200 committed Feb 6, 2018
1 parent e5db200 commit 56d7406
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/mixin/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ function _colorChange (data, oldHue) {
hsv.h = hsl.h = data.h || (data.hsl && data.hsl.h) || oldHue || 0
}

/* --- comment this block to fix #109, may cause #25 again --- */
// when the hsv.v is less than 0.0164 (base on test)
// because of possible loss of precision
// the result of hue and saturation would be miscalculated
if (hsv.v < 0.0164) {
hsv.h = data.h || (data.hsv && data.hsv.h) || 0
hsv.s = data.s || (data.hsv && data.hsv.s) || 0
}
// if (hsv.v < 0.0164) {
// hsv.h = data.h || (data.hsv && data.hsv.h) || 0
// hsv.s = data.s || (data.hsv && data.hsv.s) || 0
// }

if (hsl.l < 0.01) {
hsl.h = data.h || (data.hsl && data.hsl.h) || 0
hsl.s = data.s || (data.hsl && data.hsl.s) || 0
}
// if (hsl.l < 0.01) {
// hsl.h = data.h || (data.hsl && data.hsl.h) || 0
// hsl.s = data.s || (data.hsl && data.hsl.s) || 0
// }
/* ------ */

return {
hsl: hsl,
Expand Down

0 comments on commit 56d7406

Please sign in to comment.