The problem is that Text.getImpl_caretShape() obtains TextLayout from the parent TextFlow and then calls TextLayout.getCaretShape(pos, ...) with pos being its internal caret position. The result is getting the caret shape for position pos in the TextFlow, not relative to Text.
The problematic code in Text.java:
int pos = getImpl_caretPosition();
...
TextLayout layout = getTextLayout(); // returns parent's TextLayout
return layout.getCaretShape(pos, bias, x, y);
I would welcome any solution, e.g. either of
1) Text.getImpl_caretShape() returns correct caret shape relative to Text;
2) Text.getImpl_caretShape() return correct caret shape relative to parent TextLayout;
3) Introduce TextFlow.getImpl_caretShape().
Thanks,
Tomas
The problematic code in Text.java:
int pos = getImpl_caretPosition();
...
TextLayout layout = getTextLayout(); // returns parent's TextLayout
return layout.getCaretShape(pos, bias, x, y);
I would welcome any solution, e.g. either of
1) Text.getImpl_caretShape() returns correct caret shape relative to Text;
2) Text.getImpl_caretShape() return correct caret shape relative to parent TextLayout;
3) Introduce TextFlow.getImpl_caretShape().
Thanks,
Tomas
- relates to
-
JDK-8136346 [TextFlow] Expose API to obtain caret and selection shapes
- Resolved