mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-18 17:11:23 +01:00
ImageButton() doesn't use a clamped style.FrameRounding value but instead adjust inner image rounding when FramePadding > FrameRounding. (#2942, #845)
This commit is contained in:
@@ -170,6 +170,8 @@ Other Changes:
|
|||||||
- Images:
|
- Images:
|
||||||
- Added style.ImageRounding, ImGuiStyleVar_ImageRounding to configure
|
- Added style.ImageRounding, ImGuiStyleVar_ImageRounding to configure
|
||||||
rounding of Image() widgets. (#2942, #845)
|
rounding of Image() widgets. (#2942, #845)
|
||||||
|
- ImageButton() doesn't use a clamped style.FrameRounding value but instead
|
||||||
|
adjust inner image rounding when FramePadding > FrameRounding. (#2942, #845)
|
||||||
- Shortcuts:
|
- Shortcuts:
|
||||||
- IsItemHovered() without ImGuiHoveredFlags_AllowWhenBlockedByActiveItem
|
- IsItemHovered() without ImGuiHoveredFlags_AllowWhenBlockedByActiveItem
|
||||||
doesn't filter out the signal when activated item is a shortcut remote activation;
|
doesn't filter out the signal when activated item is a shortcut remote activation;
|
||||||
|
|||||||
@@ -1178,10 +1178,14 @@ bool ImGui::ImageButtonEx(ImGuiID id, ImTextureRef tex_ref, const ImVec2& image_
|
|||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
RenderNavCursor(bb, id);
|
RenderNavCursor(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, g.Style.FrameRounding));
|
RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding);
|
||||||
if (bg_col.w > 0.0f)
|
if (bg_col.w > 0.0f)
|
||||||
window->DrawList->AddRectFilled(bb.Min + padding, bb.Max - padding, GetColorU32(bg_col));
|
window->DrawList->AddRectFilled(bb.Min + padding, bb.Max - padding, GetColorU32(bg_col));
|
||||||
window->DrawList->AddImage(tex_ref, bb.Min + padding, bb.Max - padding, uv0, uv1, GetColorU32(tint_col));
|
float image_rounding = ImMax(g.Style.FrameRounding - ImMax(padding.x, padding.y), g.Style.ImageRounding);
|
||||||
|
if (image_rounding > 0.0f)
|
||||||
|
window->DrawList->AddImageRounded(tex_ref, bb.Min + padding, bb.Max - padding, uv0, uv1, GetColorU32(tint_col), image_rounding);
|
||||||
|
else
|
||||||
|
window->DrawList->AddImage(tex_ref, bb.Min + padding, bb.Max - padding, uv0, uv1, GetColorU32(tint_col));
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user