// Calculate to text flow
p = p.subtract(flow.getLayoutX(), flow.getLayoutY());
for( Node n : flow.getChildren() ) {
Text text = (Text) n;
if( text.getBoundsInParent().contains(p) ) {
HitInfo info = text.impl_hitTestChar(new Point2D(p.getX()-text.getLayoutX(), 0 /* See RT-28485 text.getLayoutY()*/));
if( info.getInsertionIndex() >= 0 ) {
// System.err.println("Text: " + text.getText());
// System.err.println("Text-Offset: " + text.getUserData());
// System.err.println("INSERT INDEX: " + info.getInsertionIndex());
int offset = ((Integer)text.getUserData()).intValue()+info.getInsertionIndex();
// System.err.println("NEW OFFSET AT: " + offset);
getControl().setCaretOffset(offset);
return;
}
}