-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cursor clipping in TextEdit
inside a ScrollArea
#3660
base: master
Are you sure you want to change the base?
Fix cursor clipping in TextEdit
inside a ScrollArea
#3660
Conversation
scroll_target
values
scroll_target
valuesScrollArea
now ignores unrelated scroll_target
values
The reason for this fix btw is because the temporary workaround #153 (cc @Barugon) has a problem. Notice that on the fourth Screen.Recording.2023-11-29.at.10.52.31.AM.mov |
ff4b722
to
d7bd15d
Compare
ScrollArea
now ignores unrelated scroll_target
valuesTextEdit
inside a ScrollArea
@emilk I just reimplemented this on top of the latest |
Preview available at https://egui-pr-preview.github.io/pr/3660-ignore-unrelated-scroll-targets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
/// If there was a scroll target before the ScrollArea was added this frame, it's | ||
/// not for us to handle so we save it and restore it after this ScrollArea is done. | ||
saved_scroll_target: [Option<pass_state::ScrollTarget>; 2], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also FrameState::scroll_delta
, I think we should do the same with that?
Before
Notice how the cursor hides after third enter.
Screenshot.2024-10-13.at.04.36.56.mp4
After
Cursor is always visible
Screenshot.2024-10-13.at.04.37.52.mp4
ScrollArea
now checks if there's ascroll_target
inbegin
, if there is, it saves it because it's not from its children, then restore it inend
.TextEdit
now allocates additional space if its galley grows during the frame. This is needed so that any surroundingScrollArea
can bring the cursor to view, otherwise the cursor lays outside the theScrollArea
'scontent_ui
.