mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-24 00:26:36 +00:00
TextWrapped, PushTextWrapPos(0.0f) within a window with horizontal scrolling from not covering the full horizontal area (previously only worked with an explicit contents size).
This commit is contained in:
parent
fe32fde376
commit
d6df777ff2
@ -2997,7 +2997,7 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
|
||||
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
if (wrap_pos_x == 0.0f)
|
||||
wrap_pos_x = GetContentRegionMaxAbs().x;
|
||||
wrap_pos_x = window->WorkRect.Max.x;
|
||||
else if (wrap_pos_x > 0.0f)
|
||||
wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space
|
||||
|
||||
|
@ -2154,6 +2154,7 @@ static void ShowDemoWindowLayout()
|
||||
static bool show_h_scrollbar = true;
|
||||
static bool show_button = true;
|
||||
static bool show_tree_nodes = true;
|
||||
static bool show_text_wrapped = false;
|
||||
static bool show_columns = true;
|
||||
static bool show_tab_bar = true;
|
||||
static bool explicit_content_size = false;
|
||||
@ -2167,6 +2168,7 @@ static void ShowDemoWindowLayout()
|
||||
ImGui::Checkbox("H-scrollbar", &show_h_scrollbar);
|
||||
ImGui::Checkbox("Button", &show_button); // Will grow contents size (unless explicitly overwritten)
|
||||
ImGui::Checkbox("Tree nodes", &show_tree_nodes); // Will grow contents size and display highlight over full width
|
||||
ImGui::Checkbox("Text wrapped", &show_text_wrapped);// Will grow and use contents size
|
||||
ImGui::Checkbox("Columns", &show_columns); // Will use contents size
|
||||
ImGui::Checkbox("Tab bar", &show_tab_bar); // Will use contents size
|
||||
ImGui::Checkbox("Explicit content size", &explicit_content_size);
|
||||
@ -2200,6 +2202,10 @@ static void ShowDemoWindowLayout()
|
||||
}
|
||||
ImGui::CollapsingHeader("CollapsingHeader", &open);
|
||||
}
|
||||
if (show_text_wrapped)
|
||||
{
|
||||
ImGui::TextWrapped("This text should automatically wrap on the edge of the work rectangle.");
|
||||
}
|
||||
if (show_columns)
|
||||
{
|
||||
ImGui::Columns(4);
|
||||
|
Loading…
Reference in New Issue
Block a user