RFR: 8306083: Text.hitTest is incorrect when Text node is present in TextFlow [v3]

Andy Goryachev angorya at openjdk.org
Tue Jun 27 16:15:16 UTC 2023


On Tue, 27 Jun 2023 16:06:18 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> The text run selected in `PrismTextLayout::getHitInfo()` method for character index calculation was not correct when Text node was embedded in TextFlow. Hence wrong character index value was calculated for the same.
>> 
>> Since only x, y coordinates were available in the above mentioned method, sending the text as a parameter to this method is necessary so as to know if the text run selected for character index calculation is correct. Along with this change modified the `PrismTextLayout::getHitInfo()` method to calculate the correct character index.
>> 
>> Added tests to validate the changes.
>
> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix issue with wrapped text

does not seem to work right still - if you arrange the split panes to make the emoji wrap (see the next screenshot), I think not only it shows incorrect insertion index when you move the mouse across that emoji (in Text.hitTest goes from 0 to 1, while expected change is 2), but I think it's also wrong because that emoji is the last symbol in that Text instance, so insertion index should be different (larger).
Are you reporting insertion index relative to the Text's text or TextRun?

![Screenshot 2023-06-27 at 09 07 30](https://github.com/openjdk/jfx/assets/107069028/08836b3b-c795-4b1d-803a-c0589141c9bf)

![Screenshot 2023-06-27 at 09 07 36](https://github.com/openjdk/jfx/assets/107069028/2f055077-fd04-42e8-bd4b-9c60f41c59a0)

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

PR Comment: https://git.openjdk.org/jfx/pull/1157#issuecomment-1609834407


More information about the openjfx-dev mailing list