mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
InputText: Fixed slightly off ScrollX tracking, noticeable with large values of FramePadding.x. Multiline: Fixed padding/cliprect not matching single-line version. (#3781)
Fixed FramePadding.y worth of vertical offset when aiming with mouse.
This commit is contained in:
parent
a3f0393351
commit
d1a9efdd8f
@ -51,6 +51,9 @@ Other Changes:
|
||||
- SliderInt: Fixed click/drag when v_min==v_max from setting the value to zero. (#3774) [@erwincoumans]
|
||||
Would also repro with DragFloat() when using ImGuiSliderFlags_Logarithmic with v_min==v_max.
|
||||
- Menus: Fixed an issue with child-menu auto sizing (issue introduced in 1.80 on 2021/01/25) (#3779)
|
||||
- InputText: Fixed slightly off ScrollX tracking, noticeable with large values of FramePadding.x. (#3781)
|
||||
- InputText: Multiline: Fixed padding/cliprect not precisely matching single-line version. (#3781)
|
||||
- InputText: Multiline: Fixed FramePadding.y worth of vertical offset when aiming with mouse.
|
||||
- Fonts: imgui_freetype: Facilitated using FreeType integration: [@Xipiryon, @ocornut]
|
||||
- Use '#define IMGUI_ENABLE_FREETYPE' in imconfig.h should make it work with no other modifications
|
||||
other than compiling misc/freetype/imgui_freetype.cpp and linking with FreeType.
|
||||
|
@ -3868,9 +3868,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
||||
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
||||
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
||||
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
||||
bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding);
|
||||
PopStyleVar(3);
|
||||
bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove);
|
||||
PopStyleVar(2);
|
||||
PopStyleColor();
|
||||
if (!child_visible)
|
||||
{
|
||||
@ -3880,6 +3879,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
}
|
||||
draw_window = g.CurrentWindow; // Child window
|
||||
draw_window->DC.NavLayerActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
|
||||
draw_window->DC.CursorPos += style.FramePadding;
|
||||
inner_size.x -= draw_window->ScrollbarSizes.x;
|
||||
}
|
||||
else
|
||||
@ -4040,7 +4040,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
|
||||
// Edit in progress
|
||||
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX;
|
||||
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize * 0.5f));
|
||||
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f));
|
||||
|
||||
const bool is_osx = io.ConfigMacOSXBehaviors;
|
||||
if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0]))
|
||||
@ -4489,10 +4489,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
if (!(flags & ImGuiInputTextFlags_NoHorizontalScroll))
|
||||
{
|
||||
const float scroll_increment_x = inner_size.x * 0.25f;
|
||||
const float visible_width = inner_size.x - style.FramePadding.x;
|
||||
if (cursor_offset.x < state->ScrollX)
|
||||
state->ScrollX = IM_FLOOR(ImMax(0.0f, cursor_offset.x - scroll_increment_x));
|
||||
else if (cursor_offset.x - inner_size.x >= state->ScrollX)
|
||||
state->ScrollX = IM_FLOOR(cursor_offset.x - inner_size.x + scroll_increment_x);
|
||||
else if (cursor_offset.x - visible_width >= state->ScrollX)
|
||||
state->ScrollX = IM_FLOOR(cursor_offset.x - visible_width + scroll_increment_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4597,7 +4598,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
|
||||
if (is_multiline)
|
||||
{
|
||||
Dummy(text_size);
|
||||
Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
|
||||
EndChild();
|
||||
EndGroup();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user