|
|
@@ -4522,7 +4522,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
|
|
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
|
|
|
{
|
|
|
- IM_ASSERT(window_size_x_set_by_api && window_size_x_set_by_api); // Submitted by BeginChild()
|
|
|
+ IM_ASSERT(window_size_x_set_by_api && window_size_y_set_by_api); // Submitted by BeginChild()
|
|
|
window->Size = window->SizeFull;
|
|
|
}
|
|
|
|
|
|
@@ -9889,7 +9889,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|
|
EndPopup();
|
|
|
}
|
|
|
|
|
|
-static void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, float* ref_col)
|
|
|
+static void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, const float* ref_col)
|
|
|
{
|
|
|
bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);
|
|
|
bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
|
|
|
@@ -10042,7 +10042,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
PopItemWidth();
|
|
|
}
|
|
|
|
|
|
- bool picker_active = false;
|
|
|
+ ImGuiWindow* picker_active_window = NULL;
|
|
|
if (!(flags & ImGuiColorEditFlags_NoSmallPreview))
|
|
|
{
|
|
|
if (!(flags & ImGuiColorEditFlags_NoInputs))
|
|
|
@@ -10064,7 +10064,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
|
|
|
if (BeginPopup("picker"))
|
|
|
{
|
|
|
- picker_active = true;
|
|
|
+ picker_active_window = g.CurrentWindow;
|
|
|
if (label != label_display_end)
|
|
|
{
|
|
|
TextUnformatted(label, label_display_end);
|
|
|
@@ -10086,7 +10086,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
}
|
|
|
|
|
|
// Convert back
|
|
|
- if (!picker_active)
|
|
|
+ if (picker_active_window == NULL)
|
|
|
{
|
|
|
if (!value_changed_as_float)
|
|
|
for (int n = 0; n < 4; n++)
|
|
|
@@ -10106,6 +10106,10 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
PopID();
|
|
|
EndGroup();
|
|
|
|
|
|
+ // When picker is being actively used, use its active id so IsItemActive() will function on ColorEdit4().
|
|
|
+ if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)
|
|
|
+ window->DC.LastItemId = g.ActiveId;
|
|
|
+
|
|
|
return value_changed;
|
|
|
}
|
|
|
|
|
|
@@ -10169,6 +10173,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
flags |= (g.ColorEditOptions & ImGuiColorEditFlags_AlphaBar);
|
|
|
|
|
|
// Setup
|
|
|
+ int components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;
|
|
|
bool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha);
|
|
|
ImVec2 picker_pos = window->DC.CursorPos;
|
|
|
float square_sz = SmallSquareSize();
|
|
|
@@ -10178,6 +10183,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x;
|
|
|
float bars_triangles_half_sz = (float)(int)(bars_width * 0.20f);
|
|
|
|
|
|
+ float backup_initial_col[4];
|
|
|
+ memcpy(backup_initial_col, col, components * sizeof(float));
|
|
|
+
|
|
|
float wheel_thickness = sv_picker_size * 0.08f;
|
|
|
float wheel_r_outer = sv_picker_size * 0.50f;
|
|
|
float wheel_r_inner = wheel_r_outer - wheel_thickness;
|
|
|
@@ -10293,7 +10301,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);
|
|
|
if (ColorButton("##original", ref_col_v4, (flags & (ImGuiColorEditFlags_HDR|ImGuiColorEditFlags_AlphaPreview|ImGuiColorEditFlags_AlphaPreviewHalf|ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2)))
|
|
|
{
|
|
|
- memcpy(col, ref_col, ((flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4) * sizeof(float));
|
|
|
+ memcpy(col, ref_col, components * sizeof(float));
|
|
|
value_changed = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -10423,7 +10431,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
EndGroup();
|
|
|
PopID();
|
|
|
|
|
|
- return value_changed;
|
|
|
+ return value_changed && memcmp(backup_initial_col, col, components * sizeof(float));
|
|
|
}
|
|
|
|
|
|
// Horizontal separating line.
|