Incorrect text clipping #512

Closed
opened 2016-01-27 21:14:43 +00:00 by nem0 · 4 comments
nem0 commented 2016-01-27 21:14:43 +00:00 (Migrated from github.com)

imgui_clip_error

With ImGui::PushItemWidth and FramePadding > 0, text is not correctly clipped in ImGui::InputText

It seems to be caused by this:

    const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x + style.FramePadding.x*2.0f, frame_bb.Min.y + size.y + style.FramePadding.y*2.0f);

With FramePadding == 0, everything looks ok

![imgui_clip_error](https://cloud.githubusercontent.com/assets/153526/12628298/bc5f7494-c542-11e5-9234-ab23827dfa83.png) With ~~ImGui::PushItemWidth and~~ FramePadding > 0, text is not correctly clipped in ImGui::InputText It seems to be caused by [this](https://github.com/ocornut/imgui/blob/master/imgui.cpp#L7578): ``` const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x + style.FramePadding.x*2.0f, frame_bb.Min.y + size.y + style.FramePadding.y*2.0f); ``` With FramePadding == 0, everything looks ok
itamago commented 2016-01-29 17:29:29 +00:00 (Migrated from github.com)

Yeah, I have the same issue with ImGuiListClipper and InputText, but vertically.
And it is flickering when dragging the scrollbar.
Without ImGuiListClipper, everything is clipped correctly (but more expensive in terms of CPU)

Yeah, I have the same issue with ImGuiListClipper and InputText, but vertically. And it is flickering when dragging the scrollbar. Without ImGuiListClipper, everything is clipped correctly (but more expensive in terms of CPU)
ocornut commented 2016-01-29 17:36:12 +00:00 (Migrated from github.com)

I think your issue is completely different here. Nem0 is referring to the input box contents not being clipped within the frame properly, because i'm miscalculating the aabb for cpu-side clipping of the vertices.

I think your issue is completely different here. Nem0 is referring to the input box contents not being clipped within the frame properly, because i'm miscalculating the aabb for cpu-side clipping of the vertices.
itamago commented 2016-01-29 17:47:34 +00:00 (Migrated from github.com)

ok, sorry

ok, sorry
ocornut commented 2016-01-30 14:01:29 +00:00 (Migrated from github.com)

Fixed. I think the issue started appearing along with my cleanups of last week, e.g.
ocornut/imgui@570a9dadc4

Fixed. I think the issue started appearing along with my cleanups of last week, e.g. https://github.com/ocornut/imgui/commit/570a9dadc4bfeeba4cf36fc9fda1b120ebe78d0d
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#512
No description provided.