Lines Matching defs:hit

83  * <li>hit testing,
166 * TextHitInfo hit = layout.hitTestChar(
294 * flag to supress/allow carets inside of ligatures when hit testing or
327 * @param hit1 a valid hit in <code>layout</code>
328 * @param hit2 a valid hit in <code>layout</code>
346 * by the client. With this policy, a hit on a character whose direction
347 * is the same as the line direction is stronger than a hit on a
349 * the same, a hit on the leading edge of a character is stronger
350 * than a hit on the trailing edge of a character.
764 private void checkTextHit(TextHitInfo hit) {
765 if (hit == null) {
769 if (hit.getInsertionIndex() < 0 ||
770 hit.getInsertionIndex() > characterCount) {
1047 * carets and hit testing
1072 * The text hit info (1, t) represents the trailing side of 'b'. If 'q',
1110 * hit represents the first (or last) caret in the layout. Clients
1112 * (-1, TRAILING) or (characterCount, LEADING), then the hit is at the
1193 * Returns information about the caret corresponding to <code>hit</code>.
1201 * @param hit a hit on a character in this <code>TextLayout</code>
1209 public float[] getCaretInfo(TextHitInfo hit, Rectangle2D bounds) {
1211 checkTextHit(hit);
1213 return getCaretInfoTestInternal(hit, bounds);
1219 // using the hit character's offset (baseline + ssoffset) and
1223 private float[] getCaretInfoTestInternal(TextHitInfo hit, Rectangle2D bounds) {
1225 checkTextHit(hit);
1230 getCaretInfo(hitToCaret(hit), bounds, info);
1235 int charix = hit.getCharIndex();
1236 boolean lead = hit.isLeadingEdge();
1304 * Returns information about the caret corresponding to <code>hit</code>.
1307 * @param hit a hit on a character in this <code>TextLayout</code>
1308 * @return the information about a caret corresponding to a hit. The
1311 public float[] getCaretInfo(TextHitInfo hit) {
1313 return getCaretInfo(hit, getNaturalBounds());
1317 * Returns a caret index corresponding to <code>hit</code>.
1319 * zero. This always places carets next to the character hit, on the
1321 * @param hit a hit on a character in this <code>TextLayout</code>
1322 * @return a caret index corresponding to the specified hit.
1324 private int hitToCaret(TextHitInfo hit) {
1326 int hitIndex = hit.getCharIndex();
1336 if (hit.isLeadingEdge() != textLine.isCharLTR(hitIndex)) {
1344 * Given a caret index, return a hit whose caret is at the index.
1345 * The hit is NOT guaranteed to be strong!!!
1348 * @return a hit on this layout whose strong caret is at the requested
1394 * Returns the hit for the next caret to the right (bottom); if there
1395 * is no such hit, returns <code>null</code>.
1396 * If the hit character index is out of bounds, an
1398 * @param hit a hit on a character in this layout
1399 * @return a hit whose caret appears at the next position to the
1400 * right (bottom) of the caret of the provided hit or <code>null</code>.
1402 public TextHitInfo getNextRightHit(TextHitInfo hit) {
1404 checkTextHit(hit);
1406 int caret = hitToCaret(hit);
1420 * Returns the hit for the next caret to the right (bottom); if no
1421 * such hit, returns <code>null</code>. The hit is to the right of
1424 * The returned hit is the stronger of the two possible
1430 * @return a hit whose caret appears at the next position to the
1431 * right (bottom) of the caret of the provided hit, or <code>null</code>.
1458 * Returns the hit for the next caret to the right (bottom); if no
1459 * such hit, returns <code>null</code>. The hit is to the right of
1462 * The returned hit is the stronger of the two possible
1467 * @return a hit whose caret appears at the next position to the
1468 * right (bottom) of the caret of the provided hit, or <code>null</code>.
1476 * Returns the hit for the next caret to the left (top); if no such
1477 * hit, returns <code>null</code>.
1478 * If the hit character index is out of bounds, an
1480 * @param hit a hit on a character in this <code>TextLayout</code>.
1481 * @return a hit whose caret appears at the next position to the
1482 * left (top) of the caret of the provided hit, or <code>null</code>.
1484 public TextHitInfo getNextLeftHit(TextHitInfo hit) {
1486 checkTextHit(hit);
1488 int caret = hitToCaret(hit);
1502 * Returns the hit for the next caret to the left (top); if no
1503 * such hit, returns <code>null</code>. The hit is to the left of
1506 * The returned hit is the stronger of the two possible
1512 * @return a hit whose caret appears at the next position to the
1513 * left (top) of the caret of the provided hit, or <code>null</code>.
1540 * Returns the hit for the next caret to the left (top); if no
1541 * such hit, returns <code>null</code>. The hit is to the left of
1544 * The returned hit is the stronger of the two possible
1549 * @return a hit whose caret appears at the next position to the
1550 * left (top) of the caret of the provided hit, or <code>null</code>.
1558 * Returns the hit on the opposite side of the specified hit's caret.
1559 * @param hit the specified hit
1560 * @return a hit that is on the opposite side of the specified hit's
1563 public TextHitInfo getVisualOtherHit(TextHitInfo hit) {
1566 checkTextHit(hit);
1568 int hitCharIndex = hit.getCharIndex();
1599 if (textLine.isCharLTR(hitCharIndex) == hit.isLeadingEdge()) {
1623 private double[] getCaretPath(TextHitInfo hit, Rectangle2D bounds) {
1624 float[] info = getCaretInfo(hit, bounds);
1769 * hit inside the specified bounds.
1770 * @param hit the hit at which to generate the caret
1777 public Shape getCaretShape(TextHitInfo hit, Rectangle2D bounds) {
1779 checkTextHit(hit);
1785 return pathToShape(getCaretPath(hit, bounds), false, textLine.getLayoutPath());
1790 * hit inside the natural bounds of this <code>TextLayout</code>.
1791 * @param hit the hit at which to generate the caret
1795 public Shape getCaretShape(TextHitInfo hit) {
1797 return getCaretShape(hit, getNaturalBounds());
1808 // A hit on a character with a lower level
1810 // If this rule ties, the hit on the leading edge of a character wins.
1881 TextHitInfo hit = TextHitInfo.afterOffset(offset);
1883 int hitCaret = hitToCaret(hit);
1886 Shape hitShape = pathToShape(getCaretPath(hit, bounds), false, lp);
1887 TextHitInfo otherHit = hit.getOtherHit();
1896 TextHitInfo strongHit = policy.getStrongCaret(hit, otherHit, this);
1897 boolean hitIsStrong = strongHit.equals(hit);
2453 * @return a hit describing the character and edge (leading or trailing)
2482 // revised hit test
2484 // the natural tendency is to move towards the character you want to hit
2488 // this tends to make it easier to hit narrow characters, which can be a
2554 * @return a hit describing the character and edge (leading or trailing)
2711 * Convert a hit to a point in standard coordinates. The point is
2714 * broken at the side of the character represented by the hit, the
2716 * @param hit the hit to check. This must be a valid hit on
2720 * @throws IllegalArgumentException if the hit is not valid for the
2722 * @throws NullPointerException if hit or point is null.
2725 public void hitToPoint(TextHitInfo hit, Point2D point) {
2726 if (hit == null || point == null) {
2727 throw new NullPointerException((hit == null ? "hit" : "point") +
2731 checkTextHit(hit);
2736 int ix = hit.getCharIndex();
2737 boolean leading = hit.isLeadingEdge();