Fix edit box cursor click location - #10300
Open
AdamZ-8113 wants to merge 1 commit into
Open
Conversation
Contributor
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.
Fixes #
Description of the problem being solved:
In simple terms, clicking within the item editor box is inaccurate when scaling isn't set to 100%.
At display scaling other than 100%,
EditControl:Drawpositioned each focused line using PoB’stextHeightspacing, whileDrawStringCursorIndexcalculated clicks using SimpleGraphic’s internally rounded multiline spacing. This difference accumlates over time, making clicks increasingly inaccurate farther down the editor. This behavior was confirmed by Zao (the issue is "further south" not "further east", but more or less the same).The fix makes drawing and clicking use the same line spacing. PoB determines which line was clicked using
textHeight, then callsDrawStringCursorIndexonly to find the horizontal character position within that single line. Unfocused multiline text is also drawn one line at a time, so its position no longer changes when the editor gains focus.Steps taken to verify a working solution:
Link to a build that showcases this PR:
Before screenshot:
After screenshot: