Renaming + missing initialization + missing Changelog update.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index dc5d43f..2575da1 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -65,6 +65,9 @@
- Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
- ColorEdit: Fix label alignment when using ImGuiColorEditFlags_NoInputs. (#2955) [@rokups]
+- ColorEdit: In HSV display of a RGB stored value, attempt to locally preserve Saturation
+ when Value==0.0 (similar to changes done in 1.73 for Hue). Removed Hue editing lock since
+ those improvements in 1.73 makes them unnecessary. (#2722, #2770). [@rokups]
- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
- ImDrawList: Add AddNgon(), AddNgonFilled() API with a guarantee on the explicit segment count.
In the current branch they are essentially the same as AddCircle(), AddCircleFilled() but as
@@ -75,11 +78,11 @@
- Backends: SDL: Wayland: use SDL_GetMouseState (because there is no global mouse state available
on Wayland). (#2800, #2802) [@NeroBurner]
- Examples: Explicitly adding -DIMGUI_IMPL_OPENGL_LOADER_GL3W to Makefile to match linking
- settings (otherwise if another loader such as Glew is accessible, the opengl3 backend might
- automatically use it). [#2919, #2798]
+ settings (otherwise if another loader such as Glew is accessible, the OpenGL3 backend might
+ automatically use it). (#2919, #2798)
- Examples: Metal: Wrapped main loop in @autoreleasepool block to ensure allocations get freed
- even if underlying system event loop gets paused due to app nap (#2910, #2917). [@bear24rw]
-- Examples: Added support for glbindings OpenGL loader.
+ even if underlying system event loop gets paused due to app nap. (#2910, #2917) [@bear24rw]
+- Examples: Added support for glbindings OpenGL loader. (#2870) [@rokups]
-----------------------------------------------------------------------
@@ -164,7 +167,7 @@
- Nav, Scrolling: Added support for Home/End key. (#787)
- ColorEdit: Disable Hue edit when Saturation==0 instead of letting Hue values jump around.
- ColorEdit, ColorPicker: In HSV display of a RGB stored value, attempt to locally preserve Hue
- when Saturation==0, which reduces accidentally lossy interactions. (#2722, 2770) [@rokups]
+ when Saturation==0, which reduces accidentally lossy interactions. (#2722, #2770) [@rokups]
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
Note that some elements won't accurately fade down with the same intensity, and the color wheel
when enabled will have small overlap glitches with (style.Alpha < 1.0).
diff --git a/imgui_internal.h b/imgui_internal.h
index 4ea8507..a618b3d 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -1121,7 +1121,7 @@
ImGuiID TempInputTextId; // Temporary text input when CTRL+clicking on a slider, etc.
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
- float ColorEditLastSaturation; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
+ float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
float ColorEditLastColor[3];
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
bool DragCurrentAccumDirty;
@@ -1266,7 +1266,7 @@
LastValidMousePos = ImVec2(0.0f, 0.0f);
TempInputTextId = 0;
ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
- ColorEditLastHue = 0.0f;
+ ColorEditLastHue = ColorEditLastSat = 0.0f;
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
DragCurrentAccumDirty = false;
DragCurrentAccum = 0.0f;
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index fcaaa36..1f28f46 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -4227,7 +4227,7 @@
if (f[1] == 0)
f[0] = g.ColorEditLastHue;
if (f[2] == 0)
- f[1] = g.ColorEditLastSaturation;
+ f[1] = g.ColorEditLastSat;
}
}
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
@@ -4358,7 +4358,7 @@
if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB))
{
g.ColorEditLastHue = f[0];
- g.ColorEditLastSaturation = f[1];
+ g.ColorEditLastSat = f[1];
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);
}
@@ -4546,7 +4546,7 @@
if (S == 0)
H = g.ColorEditLastHue;
if (V == 0)
- S = g.ColorEditLastSaturation;
+ S = g.ColorEditLastSat;
}
}
else if (flags & ImGuiColorEditFlags_InputHSV)
@@ -4675,7 +4675,7 @@
{
ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
g.ColorEditLastHue = H;
- g.ColorEditLastSaturation = S;
+ g.ColorEditLastSat = S;
memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);
}
else if (flags & ImGuiColorEditFlags_InputHSV)
@@ -4735,7 +4735,7 @@
if (S == 0)
H = g.ColorEditLastHue;
if (V == 0)
- S = g.ColorEditLastSaturation;
+ S = g.ColorEditLastSat;
}
}
else if (flags & ImGuiColorEditFlags_InputHSV)