/** * {@inheritDoc} * @return the point defined by target offset (if set) or the center */ @Override public Location getTarget() { if (target != null) { return target; } return getCenter(); }
/** * convenience - same as {@link Pattern#getTargetOffset()} * * @return the relative offset to the center */ public Location getTargetOffset() { return (getCenter().getOffset(getTarget())); }
/** * like {@link Pattern#targetOffset(org.sikuli.script.Location) Pattern.targetOffset} * sets the click target by offset relative to the center * * @param offset as a Location */ public void setTargetOffset(Location offset) { target = new Location(getCenter()); target.translate(offset.x, offset.y); }
@Override public String toString() { String starget; Location c = getCenter(); if (target != null && !c.equals(target)) { starget = String.format("T:%d,%d", target.x, target.y); } else { starget = String.format("C:%d,%d", c.x, c.y); } String findTimes = String.format("[%d msec]", lastFindTime); return String.format("M[%d,%d %dx%d]@S(%s) S:%.2f %s %s", x, y, w, h, ((getScreen()== null || !onScreen) ? "?" : getScreen().toStringShort()), simScore, starget, findTimes); }