|
|
|
@ -151,6 +151,7 @@ public abstract class JMacro {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
robot.mouseMove(endX, endY);
|
|
|
|
|
delay(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -187,7 +188,13 @@ public abstract class JMacro {
|
|
|
|
|
* @param rect 点
|
|
|
|
|
*/
|
|
|
|
|
public void mouseLeftClick(ViewPoint rect, long delay) {
|
|
|
|
|
mouseMove(rect);
|
|
|
|
|
|
|
|
|
|
// 获取当前鼠标位置
|
|
|
|
|
Point mousePoint = MouseInfo.getPointerInfo().getLocation();
|
|
|
|
|
if (mousePoint.x != rect.getX() || mousePoint.y != rect.getY()) {
|
|
|
|
|
Logger.info("鼠标移动至[{},{}]", rect.getX(), rect.getY());
|
|
|
|
|
mouseMove(rect);
|
|
|
|
|
}
|
|
|
|
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
delay(delay);
|
|
|
|
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
@ -380,11 +387,11 @@ public abstract class JMacro {
|
|
|
|
|
*/
|
|
|
|
|
public ViewRect findPic(ViewRect viewRect, File pic, double minSimilar) {
|
|
|
|
|
if (!pic.exists()) {
|
|
|
|
|
Logger.error("[{}] does not exist!", pic.getAbsolutePath());
|
|
|
|
|
Logger.info("[{}] does not exist!", pic.getAbsolutePath());
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (!pic.isFile()) {
|
|
|
|
|
Logger.error("[{}] is not a file!", pic.getAbsolutePath());
|
|
|
|
|
Logger.info("[{}] is not a file!", pic.getAbsolutePath());
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Logger.info("查找图片:{}", pic.getAbsolutePath());
|
|
|
|
@ -408,7 +415,7 @@ public abstract class JMacro {
|
|
|
|
|
}
|
|
|
|
|
// 当查找区域比图片还小时,直接返回失败
|
|
|
|
|
if (viewRect.getWidth() < pic.getWidth() || viewRect.getHeight() < pic.getHeight()) {
|
|
|
|
|
Logger.error("视口尺寸小于图片");
|
|
|
|
|
Logger.info("视口尺寸小于图片");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (minSimilar > 1) {
|
|
|
|
|