mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 13:07:01 +00:00
RangeSelect/MultiSelect: Removed SelectableSpacing as I'm not sure it is of use for now (history insert)
This commit is contained in:
parent
0d535afb41
commit
1b069b5d32
@ -1063,7 +1063,6 @@ ImGuiStyle::ImGuiStyle()
|
|||||||
TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||||
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||||||
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
|
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
|
||||||
SelectableSpacing = ImVec2(0,0); // Horizontal and vertical spacing between selectables (by default they are canceling out the effect of ItemSpacing).
|
|
||||||
SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||||||
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
||||||
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||||
@ -1102,7 +1101,6 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|||||||
LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);
|
LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);
|
||||||
TabRounding = ImFloor(TabRounding * scale_factor);
|
TabRounding = ImFloor(TabRounding * scale_factor);
|
||||||
TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
|
TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
|
||||||
SelectableSpacing = ImFloor(SelectableSpacing * scale_factor);
|
|
||||||
DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
|
DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
|
||||||
DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
|
DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
|
||||||
MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);
|
MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);
|
||||||
@ -2838,7 +2836,6 @@ static const ImGuiStyleVarInfo GStyleVarInfo[] =
|
|||||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
||||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
||||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
||||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableSpacing) }, // ImGuiStyleVar_SelectableSpacing
|
|
||||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
imgui.h
2
imgui.h
@ -1626,7 +1626,6 @@ enum ImGuiStyleVar_
|
|||||||
ImGuiStyleVar_GrabRounding, // float GrabRounding
|
ImGuiStyleVar_GrabRounding, // float GrabRounding
|
||||||
ImGuiStyleVar_TabRounding, // float TabRounding
|
ImGuiStyleVar_TabRounding, // float TabRounding
|
||||||
ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign
|
ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign
|
||||||
ImGuiStyleVar_SelectableSpacing, // ImVec2 SelectableSpacing
|
|
||||||
ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign
|
ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign
|
||||||
ImGuiStyleVar_COUNT
|
ImGuiStyleVar_COUNT
|
||||||
};
|
};
|
||||||
@ -1890,7 +1889,6 @@ struct ImGuiStyle
|
|||||||
float TabMinWidthForCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
float TabMinWidthForCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||||
ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||||||
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
|
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
|
||||||
ImVec2 SelectableSpacing; // Horizontal and vertical spacing between selectables (by default they are canceling out the effect of ItemSpacing).
|
|
||||||
ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||||||
ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
||||||
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
|
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
|
||||||
|
@ -1334,15 +1334,6 @@ static void ShowDemoWindowWidgets()
|
|||||||
if (winning_state)
|
if (winning_state)
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f + 0.5f * cosf(time * 2.0f), 0.5f + 0.5f * sinf(time * 3.0f)));
|
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f + 0.5f * cosf(time * 2.0f), 0.5f + 0.5f * sinf(time * 3.0f)));
|
||||||
|
|
||||||
static float spacing = 0.0f;
|
|
||||||
ImGui::PushItemWidth(100);
|
|
||||||
ImGui::SliderFloat("SelectableSpacing", &spacing, 0, 20, "%.0f");
|
|
||||||
ImGui::SameLine(); HelpMarker("Selectable cancel out the regular spacing between items by extending itself by ItemSpacing/2 in each direction.\nThis has two purposes:\n- Avoid the gap between items so the mouse is always hitting something.\n- Avoid the gap between items so range-selected item looks connected.\nBy changing SelectableSpacing we can enforce spacing between selectables.");
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
ImGui::Spacing();
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(8, 8));
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableSpacing, ImVec2(spacing, spacing));
|
|
||||||
|
|
||||||
for (int y = 0; y < 4; y++)
|
for (int y = 0; y < 4; y++)
|
||||||
for (int x = 0; x < 4; x++)
|
for (int x = 0; x < 4; x++)
|
||||||
{
|
{
|
||||||
@ -1361,10 +1352,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopStyleVar(2);
|
|
||||||
if (winning_state)
|
if (winning_state)
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
IMGUI_DEMO_MARKER("Widgets/Selectables/Alignment");
|
IMGUI_DEMO_MARKER("Widgets/Selectables/Alignment");
|
||||||
@ -6220,7 +6209,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
|
||||||
ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
|
||||||
ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
||||||
ImGui::SliderFloat2("SelectableSpacing", (float*)&style.SelectableSpacing, 0.0f, 20.0f, "%.0f"); ImGui::SameLine(); HelpMarker("SelectableSpacing must be < ItemSpacing.\nSelectables display their highlight after canceling out the effect of ItemSpacing, so they can be look tightly packed. This setting allows to enforce spacing between them.");
|
|
||||||
ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
||||||
ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
||||||
ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
||||||
|
@ -6202,8 +6202,8 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
ImRect bb(min_x, pos.y, text_max.x, text_max.y);
|
ImRect bb(min_x, pos.y, text_max.x, text_max.y);
|
||||||
if ((flags & ImGuiSelectableFlags_NoPadWithHalfSpacing) == 0)
|
if ((flags & ImGuiSelectableFlags_NoPadWithHalfSpacing) == 0)
|
||||||
{
|
{
|
||||||
const float spacing_x = span_all_columns ? 0.0f : ImMax(style.ItemSpacing.x - style.SelectableSpacing.x, 0.0f);
|
const float spacing_x = span_all_columns ? 0.0f : style.ItemSpacing.x;
|
||||||
const float spacing_y = ImMax(style.ItemSpacing.y - style.SelectableSpacing.y, 0.0f);
|
const float spacing_y = style.ItemSpacing.y;
|
||||||
const float spacing_L = IM_FLOOR(spacing_x * 0.50f);
|
const float spacing_L = IM_FLOOR(spacing_x * 0.50f);
|
||||||
const float spacing_U = IM_FLOOR(spacing_y * 0.50f);
|
const float spacing_U = IM_FLOOR(spacing_y * 0.50f);
|
||||||
bb.Min.x -= spacing_L;
|
bb.Min.x -= spacing_L;
|
||||||
|
Loading…
Reference in New Issue
Block a user