mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-15 12:59:22 +02:00
Fix empty rgb field in Create going black
This commit is contained in:
parent
be0a1ed2f8
commit
59b7cdf318
1 changed files with 6 additions and 0 deletions
|
@ -309,6 +309,9 @@ For usage and examples: colpick.com/plugin
|
|||
},
|
||||
// Fix the values if the user enters a negative or high value
|
||||
fixHSB = function (hsb) {
|
||||
hsb.h = isNaN(hsb.h) ? 0 : hsb.h;
|
||||
hsb.s = isNaN(hsb.s) ? 0 : hsb.s;
|
||||
hsb.b = isNaN(hsb.b) ? 0 : hsb.b;
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, hsb.h)),
|
||||
s: Math.min(100, Math.max(0, hsb.s)),
|
||||
|
@ -316,6 +319,9 @@ For usage and examples: colpick.com/plugin
|
|||
};
|
||||
},
|
||||
fixRGB = function (rgb) {
|
||||
rgb.r = isNaN(rgb.r) ? 0 : rgb.r;
|
||||
rgb.g = isNaN(rgb.g) ? 0 : rgb.g;
|
||||
rgb.b = isNaN(rgb.b) ? 0 : rgb.b;
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, rgb.r)),
|
||||
g: Math.min(255, Math.max(0, rgb.g)),
|
||||
|
|
Loading…
Reference in a new issue