-
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
egui_web: constrain the IME text agent to the canvas #830
Conversation
egui_web/src/lib.rs
Outdated
// style.set_property("top", &(y.to_string() + "px")).ok()?; | ||
// style.set_property("left", &(x.to_string() + "px")).ok() | ||
// }) | ||
// } else { |
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.
did you think about what this code was being used for? have you tested that IME still works as expected?
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.
Oh sorry, I must have misunderstood a bit. I feel that by suppressing the position of the text agent from almost sticking out of the client area of the browser, the position of the IME will also stay in line with the position of the text cursor. Is this a good fix?
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.
@n2 wrote the original code, perhaps they have some thoughts?
@emilk I've also checked the IME position tracking. There is a subtle difference in the IME position tracking compared to the browser native text input, but it seems to be a practical problem. |
f99b0b8
to
cc79d05
Compare
Note: For some reason the CI test was failing, so I rebased to the latest master branch. When I did that, the old commits you had linked to the review comments disappeared. |
As mentioned in the comments, move_text_cursor() is used to move IME candidate window following egui's cursor. It is better to constrain the position within the canvas, rather than just delete the function. I think your newly submitted code is suitable. Thank you for fixing the overlooked part of my code. @sumibi-yakitori |
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.
Nice, that looks like a much better solution to me!
Thanks for your thoughts, @n2 !
If you enter a large number of line breaks where the height of
TextEdit
exceeds the height of the browser window, and then enter more non-line breaks, the egui screen will be driven out of the client areaAlso, since scrolling is currently disabled in a browser itself, there doesn't seem to be much benefit in changing the position of thetext_agent
I apologize for my terrible English