2
0
Эх сурвалжийг харах

InputText(): fixed cursor pixel-alignment when horizontally scrolled.

ocornut 10 жил өмнө
parent
commit
ff12afbd18
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      imgui.cpp

+ 3 - 3
imgui.cpp

@@ -7127,7 +7127,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
             else
             else
             {
             {
                 edit_state.Id = id;
                 edit_state.Id = id;
-                edit_state.ScrollX = 0.f;
+                edit_state.ScrollX = 0.0f;
                 stb_textedit_initialize_state(&edit_state.StbState, !is_multiline);
                 stb_textedit_initialize_state(&edit_state.StbState, !is_multiline);
                 if (!is_multiline && focus_requested_by_code)
                 if (!is_multiline && focus_requested_by_code)
                     select_all = true;
                     select_all = true;
@@ -7447,9 +7447,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
             {
             {
                 const float scroll_increment_x = size.x * 0.25f;
                 const float scroll_increment_x = size.x * 0.25f;
                 if (cursor_offset.x < edit_state.ScrollX)
                 if (cursor_offset.x < edit_state.ScrollX)
-                    edit_state.ScrollX = ImMax(0.0f, cursor_offset.x - scroll_increment_x);
+                    edit_state.ScrollX = (float)(int)ImMax(0.0f, cursor_offset.x - scroll_increment_x);
                 else if (cursor_offset.x - size.x >= edit_state.ScrollX)
                 else if (cursor_offset.x - size.x >= edit_state.ScrollX)
-                    edit_state.ScrollX = cursor_offset.x - size.x + scroll_increment_x;
+                    edit_state.ScrollX = (float)(int)(cursor_offset.x - size.x + scroll_increment_x);
             }
             }
             else
             else
             {
             {