mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
ColorEdit: Disable Hue edit when Saturation==0 instead of letting Hue values jump around.
This commit is contained in:
parent
b59ec7b9b7
commit
0537ac005f
@ -37,6 +37,7 @@ Other Changes:
|
||||
- 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).
|
||||
- ColorEdit: Disable Hue edit when Saturation==0 instead of letting Hue values jump around.
|
||||
- TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
|
||||
- TabBar: fixed single-tab not shrinking their width down.
|
||||
- TabBar: feed desired width (sum of unclipped tabs width) into layout system to allow for auto-resize. (#2768)
|
||||
|
@ -4234,14 +4234,17 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
if (n > 0)
|
||||
SameLine(0, style.ItemInnerSpacing.x);
|
||||
SetNextItemWidth((n + 1 < components) ? w_item_one : w_item_last);
|
||||
|
||||
// Disable Hue edit when Saturation is zero
|
||||
const bool disable_hue_edit = (n == 0 && (flags & ImGuiColorEditFlags_DisplayHSV) && i[1] == 0);
|
||||
if (flags & ImGuiColorEditFlags_Float)
|
||||
{
|
||||
value_changed |= DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
|
||||
value_changed |= DragFloat(ids[n], &f[n], 1.0f/255.0f, disable_hue_edit ? +FLT_MAX : 0.0f, disable_hue_edit ? -FLT_MAX : hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
|
||||
value_changed_as_float |= value_changed;
|
||||
}
|
||||
else
|
||||
{
|
||||
value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
|
||||
value_changed |= DragInt(ids[n], &i[n], 1.0f, disable_hue_edit ? INT_MAX : 0, disable_hue_edit ? INT_MIN : hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
|
||||
}
|
||||
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
||||
OpenPopupOnItemClick("context");
|
||||
|
Loading…
Reference in New Issue
Block a user