/** * Find the caret index at the give point * * @param point * the point relative to coordinate system of this node * @return the index or <code>-1</code> if not found */ public int getCaretIndexAtPoint(Point2D point) { Point2D scenePoint = localToScene(point); for (StyledTextNode t : this.textNodes) { if (t.localToScene(t.getBoundsInLocal()).contains(scenePoint)) { return t.getCaretIndexAtPoint(t.sceneToLocal(scenePoint)) + t.getStartOffset(); } } return -1; }