Lines Matching refs:rect1

448      * Is rect1 a better candidate than rect2 for a focus search in a particular
453 * @param rect1 The candidate rectangle
457 boolean isBetterCandidate(int direction, Rect source, Rect rect1, Rect rect2) {
461 if (!isCandidate(source, rect1, direction)) {
465 // we know that rect1 is a candidate.. if rect2 is not a candidate,
466 // rect1 is better
471 // if rect1 is better by beam, it wins
472 if (beamBeats(direction, source, rect1, rect2)) {
476 // if rect2 is better, then rect1 cant' be :)
477 if (beamBeats(direction, source, rect2, rect1)) {
483 majorAxisDistance(direction, source, rect1),
484 minorAxisDistance(direction, source, rect1))
493 * @return Whether rect1 is a better candidate than rect2 by virtue of it being in src's
496 boolean beamBeats(int direction, Rect source, Rect rect1, Rect rect2) {
497 final boolean rect1InSrcBeam = beamsOverlap(direction, source, rect1);
500 // if rect1 isn't exclusively in the src beam, it doesn't win
505 // we know rect1 is in the beam, and rect2 is not
507 // if rect1 is to the direction of, and rect2 is not, rect1 wins.
508 // for example, for direction left, if rect1 is to the left of the source
509 // and rect2 is below, then we always prefer the in beam rect1, since rect2
521 // now, as long as rect2 isn't completely closer, rect1 wins
523 // edge to be closer to the source's top edge than rect1's bottom edge.
524 return (majorAxisDistance(direction, source, rect1)
567 * Do the "beams" w.r.t the given direction's axis of rect1 and rect2 overlap?
569 * @param rect1 The first rectangle
573 boolean beamsOverlap(int direction, Rect rect1, Rect rect2) {
577 return (rect2.bottom > rect1.top) && (rect2.top < rect1.bottom);
580 return (rect2.right > rect1.left) && (rect2.left < rect1.right);