瀏覽代碼

InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794)

ocornut 3 年之前
父節點
當前提交
bdd2a94315
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      docs/CHANGELOG.txt
  2. 1 1
      imgui_widgets.cpp

+ 2 - 1
docs/CHANGELOG.txt

@@ -66,7 +66,8 @@ Other Changes:
 - InputText: made double-click select word, triple-line select line. Word delimitation logic differs
 - InputText: made double-click select word, triple-line select line. Word delimitation logic differs
   slightly from the one used by CTRL+arrows. (#2244)
   slightly from the one used by CTRL+arrows. (#2244)
 - InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev]
 - InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev]
-- InputText: fixed incorrect padding when FrameBorder > 0. (#4794, #3781)
+- InputTextMultiline: fixed incorrect padding when FrameBorder > 0. (#3781, #4794)
+- InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794)
 - Separator: fixed cover all columns while called inside a table. (#4787)
 - Separator: fixed cover all columns while called inside a table. (#4787)
 - Clipper: currently focused item is automatically included in clipper range.
 - Clipper: currently focused item is automatically included in clipper range.
   Fixes issue where e.g. drag and dropping an item and scrolling ensure the item source location is
   Fixes issue where e.g. drag and dropping an item and scrolling ensure the item source location is

+ 1 - 1
imgui_widgets.cpp

@@ -4693,7 +4693,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
                 // Test if cursor is vertically visible
                 // Test if cursor is vertically visible
                 if (cursor_offset.y - g.FontSize < scroll_y)
                 if (cursor_offset.y - g.FontSize < scroll_y)
                     scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
                     scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
-                else if (cursor_offset.y - inner_size.y >= scroll_y)
+                else if (cursor_offset.y - (inner_size.y - style.FramePadding.y * 2.0f) >= scroll_y)
                     scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
                     scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
                 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(scroll_y, 0.0f, scroll_max_y);
                 scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);