Fix(Web): prevent invisible IME agent from intercepting mouse clicks near cursor - #8273
Open
rustbasic wants to merge 3 commits into
Open
Fix(Web): prevent invisible IME agent from intercepting mouse clicks near cursor#8273rustbasic wants to merge 3 commits into
rustbasic wants to merge 3 commits into
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/8273-p105 View snapshot changes at kitdiff |
Changed from `left_top()` to `left_bottom()` to change the scroll reference point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix(Web): prevent invisible IME agent from intercepting mouse clicks near cursor
Problem
In WASM/Web environments,
eguiprovidesIMEOutputto the browser to handle IME composition and mobile text input. The browser creates an invisible text agent (like a hidden<textarea>) based on the providedcursor_rect.However, this hidden element often possesses a small physical hitbox (especially to the right of the cursor). This causes a bug where mouse clicks occurring slightly to the right of the text cursor are intercepted by the browser's hidden element and never reach the
eguicanvas, resulting in "dead zones" for user interaction.Note that this symptom does not occur when the text cursor is placed between English characters, likely because the character spacing is too narrow for a dead zone to form. It only occurs when the cursor is positioned between non-English characters (such as Korean) or certain ASCII punctuation like a period (
.).Solution
This PR modifies the
cursor_rectpassed toIMEOutputto be a zero-widthRect(tiny_rect).Vec2::ZERO, the browser's invisible agent no longer has a clickable area, ensuring all pointer events are correctly delivered to theeguicanvas.left_bottomposition is preserved, so IME candidate windows (like Hanja or Emoji pickers) still appear at the correct coordinate relative to the cursor.Impact
TextEdit(WASM) is now 100% reliable.