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

Karthik P K kpk at openjdk.org
Fri Jun 30 15:59:01 UTC 2023


On Fri, 30 Jun 2023 14:40:14 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 character index calculation issue

Fixed the character index and insertion index issue mentioned above. Please check.
One more issue I observed is that when Text node is displayed in single line, correct x coordinate is picked up by Mouse event, but when text is displayed in more than one line, x coordinate picked up by Mouse event at the same position is different.
<img width="1365" alt="image" src="https://github.com/openjdk/jfx/assets/26969459/1f7db133-12bf-445a-a5dd-89a70d6fa3cc">
x value in highlighted position is 7.01

![image](https://github.com/openjdk/jfx/assets/26969459/5e521813-1bd3-4200-b5c1-424597795010)
x value in highlighted position is 83.0.

Looks like there is issue in MouseEvent or PickResult.

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

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


More information about the openjfx-dev mailing list