mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
fix: set color picker alpha on reset (#2173)
* fix: set color picker alpha on reset Fixes a bug where the colour picker enhancement widget without alpha uses a garbage value for alpha on reset Co-authored-by: sonoftunk <sonoftunk@gmail.com> * formatting Co-authored-by: sonoftunk <sonoftunk@gmail.com> Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
parent
99c1f046a6
commit
9a9b4bd679
1 changed files with 3 additions and 3 deletions
|
@ -528,13 +528,13 @@ namespace UIWidgets {
|
||||||
colors->x = defaultcolors.x;
|
colors->x = defaultcolors.x;
|
||||||
colors->y = defaultcolors.y;
|
colors->y = defaultcolors.y;
|
||||||
colors->z = defaultcolors.z;
|
colors->z = defaultcolors.z;
|
||||||
if (has_alpha) { colors->w = defaultcolors.w; };
|
colors->w = has_alpha ? defaultcolors.w : 255.0f;
|
||||||
|
|
||||||
Color_RGBA8 colorsRGBA;
|
Color_RGBA8 colorsRGBA;
|
||||||
colorsRGBA.r = defaultcolors.x;
|
colorsRGBA.r = defaultcolors.x;
|
||||||
colorsRGBA.g = defaultcolors.y;
|
colorsRGBA.g = defaultcolors.y;
|
||||||
colorsRGBA.b = defaultcolors.z;
|
colorsRGBA.b = defaultcolors.z;
|
||||||
if (has_alpha) { colorsRGBA.a = defaultcolors.w; };
|
colorsRGBA.a = has_alpha ? defaultcolors.w : 255.0f;
|
||||||
|
|
||||||
CVar_SetRGBA(cvarName, colorsRGBA);
|
CVar_SetRGBA(cvarName, colorsRGBA);
|
||||||
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||||
|
@ -616,7 +616,7 @@ namespace UIWidgets {
|
||||||
colors.r = ColorRGBA.x * 255.0;
|
colors.r = ColorRGBA.x * 255.0;
|
||||||
colors.g = ColorRGBA.y * 255.0;
|
colors.g = ColorRGBA.y * 255.0;
|
||||||
colors.b = ColorRGBA.z * 255.0;
|
colors.b = ColorRGBA.z * 255.0;
|
||||||
colors.a = ColorRGBA.w * 255.0;
|
colors.a = 255.0;
|
||||||
|
|
||||||
CVar_SetRGBA(cvarName, colors);
|
CVar_SetRGBA(cvarName, colors);
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue