Lines Matching defs:hit

84  * <li>hit testing,
167 * TextHitInfo hit = layout.hitTestChar(
294 * flag to suppress/allow carets inside of ligatures when hit testing or
327 * @param hit1 a valid hit in {@code layout}
328 * @param hit2 a valid hit in {@code layout}
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.
769 private void checkTextHit(TextHitInfo hit) {
770 if (hit == null) {
774 if (hit.getInsertionIndex() < 0 ||
775 hit.getInsertionIndex() > characterCount) {
1052 * carets and hit testing
1077 * The text hit info (1, t) represents the trailing side of 'b'. If 'q',
1115 * hit represents the first (or last) caret in the layout. Clients
1117 * (-1, TRAILING) or (characterCount, LEADING), then the hit is at the
1198 * Returns information about the caret corresponding to {@code hit}.
1206 * @param hit a hit on a character in this {@code TextLayout}
1214 public float[] getCaretInfo(TextHitInfo hit, Rectangle2D bounds) {
1216 checkTextHit(hit);
1218 return getCaretInfoTestInternal(hit, bounds);
1224 // using the hit character's offset (baseline + ssoffset) and
1228 private float[] getCaretInfoTestInternal(TextHitInfo hit, Rectangle2D bounds) {
1230 checkTextHit(hit);
1235 getCaretInfo(hitToCaret(hit), bounds, info);
1240 int charix = hit.getCharIndex();
1241 boolean lead = hit.isLeadingEdge();
1309 * Returns information about the caret corresponding to {@code hit}.
1312 * @param hit a hit on a character in this {@code TextLayout}
1313 * @return the information about a caret corresponding to a hit. The
1316 public float[] getCaretInfo(TextHitInfo hit) {
1318 return getCaretInfo(hit, getNaturalBounds());
1322 * Returns a caret index corresponding to {@code hit}.
1324 * zero. This always places carets next to the character hit, on the
1326 * @param hit a hit on a character in this {@code TextLayout}
1327 * @return a caret index corresponding to the specified hit.
1329 private int hitToCaret(TextHitInfo hit) {
1331 int hitIndex = hit.getCharIndex();
1341 if (hit.isLeadingEdge() != textLine.isCharLTR(hitIndex)) {
1349 * Given a caret index, return a hit whose caret is at the index.
1350 * The hit is NOT guaranteed to be strong!!!
1353 * @return a hit on this layout whose strong caret is at the requested
1399 * Returns the hit for the next caret to the right (bottom); if there
1400 * is no such hit, returns {@code null}.
1401 * If the hit character index is out of bounds, an
1403 * @param hit a hit on a character in this layout
1404 * @return a hit whose caret appears at the next position to the
1405 * right (bottom) of the caret of the provided hit or {@code null}.
1407 public TextHitInfo getNextRightHit(TextHitInfo hit) {
1409 checkTextHit(hit);
1411 int caret = hitToCaret(hit);
1425 * Returns the hit for the next caret to the right (bottom); if no
1426 * such hit, returns {@code null}. The hit is to the right of
1429 * The returned hit is the stronger of the two possible
1435 * @return a hit whose caret appears at the next position to the
1436 * right (bottom) of the caret of the provided hit, or {@code null}.
1463 * Returns the hit for the next caret to the right (bottom); if no
1464 * such hit, returns {@code null}. The hit is to the right of
1467 * The returned hit is the stronger of the two possible
1472 * @return a hit whose caret appears at the next position to the
1473 * right (bottom) of the caret of the provided hit, or {@code null}.
1481 * Returns the hit for the next caret to the left (top); if no such
1482 * hit, returns {@code null}.
1483 * If the hit character index is out of bounds, an
1485 * @param hit a hit on a character in this {@code TextLayout}.
1486 * @return a hit whose caret appears at the next position to the
1487 * left (top) of the caret of the provided hit, or {@code null}.
1489 public TextHitInfo getNextLeftHit(TextHitInfo hit) {
1491 checkTextHit(hit);
1493 int caret = hitToCaret(hit);
1507 * Returns the hit for the next caret to the left (top); if no
1508 * such hit, returns {@code null}. The hit is to the left of
1511 * The returned hit is the stronger of the two possible
1517 * @return a hit whose caret appears at the next position to the
1518 * left (top) of the caret of the provided hit, or {@code null}.
1545 * Returns the hit for the next caret to the left (top); if no
1546 * such hit, returns {@code null}. The hit is to the left of
1549 * The returned hit is the stronger of the two possible
1554 * @return a hit whose caret appears at the next position to the
1555 * left (top) of the caret of the provided hit, or {@code null}.
1563 * Returns the hit on the opposite side of the specified hit's caret.
1564 * @param hit the specified hit
1565 * @return a hit that is on the opposite side of the specified hit's
1568 public TextHitInfo getVisualOtherHit(TextHitInfo hit) {
1571 checkTextHit(hit);
1573 int hitCharIndex = hit.getCharIndex();
1604 if (textLine.isCharLTR(hitCharIndex) == hit.isLeadingEdge()) {
1628 private double[] getCaretPath(TextHitInfo hit, Rectangle2D bounds) {
1629 float[] info = getCaretInfo(hit, bounds);
1774 * hit inside the specified bounds.
1775 * @param hit the hit at which to generate the caret
1782 public Shape getCaretShape(TextHitInfo hit, Rectangle2D bounds) {
1784 checkTextHit(hit);
1790 return pathToShape(getCaretPath(hit, bounds), false, textLine.getLayoutPath());
1795 * hit inside the natural bounds of this {@code TextLayout}.
1796 * @param hit the hit at which to generate the caret
1800 public Shape getCaretShape(TextHitInfo hit) {
1802 return getCaretShape(hit, getNaturalBounds());
1813 // A hit on a character with a lower level
1815 // If this rule ties, the hit on the leading edge of a character wins.
1886 TextHitInfo hit = TextHitInfo.afterOffset(offset);
1888 int hitCaret = hitToCaret(hit);
1891 Shape hitShape = pathToShape(getCaretPath(hit, bounds), false, lp);
1892 TextHitInfo otherHit = hit.getOtherHit();
1901 TextHitInfo strongHit = policy.getStrongCaret(hit, otherHit, this);
1902 boolean hitIsStrong = strongHit.equals(hit);
2458 * @return a hit describing the character and edge (leading or trailing)
2487 // revised hit test
2489 // the natural tendency is to move towards the character you want to hit
2493 // this tends to make it easier to hit narrow characters, which can be a
2559 * @return a hit describing the character and edge (leading or trailing)
2682 * Convert a hit to a point in standard coordinates. The point is
2685 * broken at the side of the character represented by the hit, the
2687 * @param hit the hit to check. This must be a valid hit on
2691 * @throws IllegalArgumentException if the hit is not valid for the
2693 * @throws NullPointerException if hit or point is null.
2696 public void hitToPoint(TextHitInfo hit, Point2D point) {
2697 if (hit == null || point == null) {
2698 throw new NullPointerException((hit == null ? "hit" : "point") +
2702 checkTextHit(hit);
2707 int ix = hit.getCharIndex();
2708 boolean leading = hit.isLeadingEdge();