mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ColorEdit: Fixed tooltip not honoring the ImGuiColorEditFlags_NoAlpha contract of never reading the 4th float in the array (value was read and discarded). (#2384)
This commit is contained in:
parent
66936880ba
commit
8e0e91827f
@ -64,6 +64,8 @@ Other Changes:
|
||||
when manipulating the scrollbar of a multi-line input text.
|
||||
- ColorPicker: Fixed a bug/assertion when displaying a color picker in a collapsed window
|
||||
while dragging its title bar. (#2389)
|
||||
- ColorEdit: Fixed tooltip not honoring the ImGuiColorEditFlags_NoAlpha contract of never
|
||||
reading the 4th float in the array (value was read and discarded). (#2384) [@haldean]
|
||||
- MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67).
|
||||
- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371)
|
||||
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
|
||||
|
@ -4648,9 +4648,7 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);
|
||||
BeginTooltipEx(0, true);
|
||||
|
||||
const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text;
|
||||
if (text_end > text)
|
||||
{
|
||||
@ -4659,7 +4657,9 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags
|
||||
}
|
||||
|
||||
ImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2);
|
||||
ColorButton("##preview", ImVec4(col[0], col[1], col[2], col[3]), (flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz);
|
||||
ImVec4 cf(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
|
||||
int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);
|
||||
ColorButton("##preview", cf, (flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz);
|
||||
SameLine();
|
||||
if (flags & ImGuiColorEditFlags_NoAlpha)
|
||||
Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);
|
||||
|
Loading…
Reference in New Issue
Block a user