mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ColorPicker3/4: Fixed missing ID scoping (#346)
This commit is contained in:
parent
6a241d4895
commit
9e817a7c38
@ -8755,6 +8755,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
ImGuiStyle& style = ImGui::GetStyle();
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
|
ImGui::PushID(label);
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
bool alpha = (flags & ImGuiColorEditFlags_Alpha) != 0;
|
bool alpha = (flags & ImGuiColorEditFlags_Alpha) != 0;
|
||||||
ImVec2 picker_pos = ImGui::GetCursorScreenPos();
|
ImVec2 picker_pos = ImGui::GetCursorScreenPos();
|
||||||
@ -8768,7 +8771,6 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
|
|
||||||
// Color matrix logic
|
// Color matrix logic
|
||||||
bool value_changed = false, hsv_changed = false;
|
bool value_changed = false, hsv_changed = false;
|
||||||
ImGui::BeginGroup();
|
|
||||||
ImGui::InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size));
|
ImGui::InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size));
|
||||||
if (ImGui::IsItemActive())
|
if (ImGui::IsItemActive())
|
||||||
{
|
{
|
||||||
@ -8874,7 +8876,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
draw_list->AddLine(ImVec2(p.x + CROSSHAIR_SIZE, p.y), ImVec2(p.x + 2, p.y), IM_COL32_WHITE);
|
draw_list->AddLine(ImVec2(p.x + CROSSHAIR_SIZE, p.y), ImVec2(p.x + 2, p.y), IM_COL32_WHITE);
|
||||||
draw_list->AddLine(ImVec2(p.x, p.y + CROSSHAIR_SIZE), ImVec2(p.x, p.y + 2), IM_COL32_WHITE);
|
draw_list->AddLine(ImVec2(p.x, p.y + CROSSHAIR_SIZE), ImVec2(p.x, p.y + 2), IM_COL32_WHITE);
|
||||||
draw_list->AddLine(ImVec2(p.x, p.y - CROSSHAIR_SIZE), ImVec2(p.x, p.y - 2), IM_COL32_WHITE);
|
draw_list->AddLine(ImVec2(p.x, p.y - CROSSHAIR_SIZE), ImVec2(p.x, p.y - 2), IM_COL32_WHITE);
|
||||||
|
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user