InputTextMultiline(): fixed a minor bug where Shift+Wheel would allow a small horizontal scroll offset. (#9249)
This commit is contained in:
@@ -168,6 +168,8 @@ Other Changes:
|
|||||||
next to each components, in multi-components functions.
|
next to each components, in multi-components functions.
|
||||||
- Added a way to select a specific marker color.
|
- Added a way to select a specific marker color.
|
||||||
- InputText:
|
- InputText:
|
||||||
|
- InputTextMultiline(): fixed a minor bug where Shift+Wheel would allow a small
|
||||||
|
horizontal scroll offset when there should be none. (#9249)
|
||||||
- ImGuiInputTextCallbackData: SelectAll() also sets CursorPos to SelectionEnd.
|
- ImGuiInputTextCallbackData: SelectAll() also sets CursorPos to SelectionEnd.
|
||||||
- ImGuiInputTextCallbackData: Added SetSelection() helper.
|
- ImGuiInputTextCallbackData: Added SetSelection() helper.
|
||||||
- ImGuiInputTextCallbackData: Added ID and EventActive helpers. (#9174)
|
- ImGuiInputTextCallbackData: Added ID and EventActive helpers. (#9174)
|
||||||
|
|||||||
+3
-4
@@ -5400,7 +5400,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 draw_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;
|
ImVec2 draw_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;
|
||||||
ImVec2 text_size(0.0f, 0.0f);
|
|
||||||
ImRect clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + inner_size.x, frame_bb.Min.y + inner_size.y); // Not using frame_bb.Max because we have adjusted size
|
ImRect clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + inner_size.x, frame_bb.Min.y + inner_size.y); // Not using frame_bb.Max because we have adjusted size
|
||||||
if (is_multiline)
|
if (is_multiline)
|
||||||
clip_rect.ClipWith(draw_window->ClipRect);
|
clip_rect.ClipWith(draw_window->ClipRect);
|
||||||
@@ -5458,7 +5457,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
line_visible_n1 = ImMin(line_visible_n1, line_count);
|
line_visible_n1 = ImMin(line_visible_n1, line_count);
|
||||||
|
|
||||||
// Store text height (we don't need width)
|
// Store text height (we don't need width)
|
||||||
text_size = ImVec2(inner_size.x, line_count * g.FontSize);
|
float text_size_y = line_count * g.FontSize;
|
||||||
//GetForegroundDrawList()->AddRect(draw_pos + ImVec2(0, line_visible_n0 * g.FontSize), draw_pos + ImVec2(frame_size.x, line_visible_n1 * g.FontSize), IM_COL32(255, 0, 0, 255));
|
//GetForegroundDrawList()->AddRect(draw_pos + ImVec2(0, line_visible_n0 * g.FontSize), draw_pos + ImVec2(frame_size.x, line_visible_n1 * g.FontSize), IM_COL32(255, 0, 0, 255));
|
||||||
|
|
||||||
// Calculate blinking cursor position
|
// Calculate blinking cursor position
|
||||||
@@ -5518,7 +5517,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
if (new_scroll_y != scroll_y)
|
if (new_scroll_y != scroll_y)
|
||||||
{
|
{
|
||||||
const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
|
const float scroll_max_y = ImMax((text_size_y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
|
||||||
scroll_y = ImClamp(new_scroll_y, 0.0f, scroll_max_y);
|
scroll_y = ImClamp(new_scroll_y, 0.0f, scroll_max_y);
|
||||||
draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
|
draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
|
||||||
draw_window->Scroll.y = scroll_y;
|
draw_window->Scroll.y = scroll_y;
|
||||||
@@ -5611,7 +5610,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (is_multiline)
|
if (is_multiline)
|
||||||
{
|
{
|
||||||
// For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (see #4761, #7870)...
|
// For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (see #4761, #7870)...
|
||||||
Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
|
Dummy(ImVec2(0.0f, text_size_y + style.FramePadding.y));
|
||||||
g.NextItemData.ItemFlags |= (ImGuiItemFlags)ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
|
g.NextItemData.ItemFlags |= (ImGuiItemFlags)ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
|
||||||
EndChild();
|
EndChild();
|
||||||
item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow);
|
item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user