When hitTest() is invoked for the Text node in a TextFlow with more than one Text child, the character index and the insertion index values obtained are not correct.
User monkey tester app to reproduce the issue: https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/monkey/MonkeyTesterApp.java
Steps to reproduce the issue:
1. Open Monkey Tester app and select TextFlow.
2. From Text dropdown on the right side, select Rich Text and Font Size 48.
3. Start hovering mouse on the text "BOLD" and observe the hitTest values of Text on the right side. When the mouse is hovered over trailing side of "O", character index returned is 2 which should have been 1. When cursor is hovered over letter "D", character index returned is 5 whereas expected char index is 3.
The issue is because of the bug in the logic of looping through the array of text runs in getHitInfo method of PrismTextLayout.java which results in calculating character index value using wrong text run for the given Text node.
User monkey tester app to reproduce the issue: https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/monkey/MonkeyTesterApp.java
Steps to reproduce the issue:
1. Open Monkey Tester app and select TextFlow.
2. From Text dropdown on the right side, select Rich Text and Font Size 48.
3. Start hovering mouse on the text "BOLD" and observe the hitTest values of Text on the right side. When the mouse is hovered over trailing side of "O", character index returned is 2 which should have been 1. When cursor is hovered over letter "D", character index returned is 5 whereas expected char index is 3.
The issue is because of the bug in the logic of looping through the array of text runs in getHitInfo method of PrismTextLayout.java which results in calculating character index value using wrong text run for the given Text node.
- is blocked by
-
JDK-8311626 Incorrect x coordinate value reported by PickResult::getIntersectedPoint
- Closed
- relates to
-
JDK-8304831 TextFlow.hitTest.insertionIndex incorrect with surrogate pairs
- Resolved