RFR: 8319844 : Text/TextFlow.hitTest() is incorrect in RTL orientation [v11]

Karthik P K kpk at openjdk.org
Wed Feb 21 13:06:02 UTC 2024


On Mon, 19 Feb 2024 14:32:36 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> To determine the runStart/runEnd, `Text` is already analyzing the runs (and doing coordinate tests on them). Runs however have locations, with x/y coordinates. Would it not be possible, and more sensible, to adjust the `x`, `y` coordinates passed to `getHitInfo` instead of leaving those as coordinates relative to the `Text` ? I mean, you are using the parents `TextLayout`, so it would make sense to pass that `TextLayout` coordinates that are correct for it in the first place?
> 

I'm afraid we can't do this. Primarily because if we pass `TextLayout` coordinates in the case of Text node embedded in TextFlow, we do not know if the character index needs to be calculated relative to the Text node or for the entire TextFlow. There is no way we could figure out this case without the extra parameters.
Also if we do not pass the start value of the TextRun on which hit test is requested, there is no way to figure out on which Text node it is requested when same Text is repeated in the TextFlow.
For the case like wrapped Text node inside TextFlow, we need to have text value, otherwise we can't determine if the same text is present in the previous line.
So I believe we need these extra parameters to calculate the hit info for all the cases.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1323#issuecomment-1956608182


More information about the openjfx-dev mailing list