|
|
@ -141,7 +141,7 @@ public abstract class JMacro {
|
|
|
|
double absY = Math.abs(startY - endY);
|
|
|
|
double absY = Math.abs(startY - endY);
|
|
|
|
double absZ = Math.sqrt(Math.pow(absX, 2) + Math.pow(absY, 2));
|
|
|
|
double absZ = Math.sqrt(Math.pow(absX, 2) + Math.pow(absY, 2));
|
|
|
|
int times = (int) (absZ / 15 + (absZ % 15 > 0 ? 1 : 0));
|
|
|
|
int times = (int) (absZ / 15 + (absZ % 15 > 0 ? 1 : 0));
|
|
|
|
int interval = (int) Math.max((absZ/4) / times, 10);
|
|
|
|
int interval = (int) Math.max((absZ / 4) / times, 10);
|
|
|
|
|
|
|
|
|
|
|
|
times = Math.min(times, 10);
|
|
|
|
times = Math.min(times, 10);
|
|
|
|
// 分times次移动到指定点
|
|
|
|
// 分times次移动到指定点
|
|
|
@ -157,25 +157,43 @@ public abstract class JMacro {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 鼠标左键单击
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param rect 矩形区域
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void mouseLeftClick(ViewRect rect) {
|
|
|
|
|
|
|
|
mouseLeftClick(rect, 100);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 鼠标左键单击
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param rect 矩形区域
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void mouseLeftClick(ViewRect rect, long delay) {
|
|
|
|
|
|
|
|
mouseLeftClick(new ViewPoint(rect.getCenter().getX(), rect.getCenter().getY()), delay);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 鼠标左键单击
|
|
|
|
* 鼠标左键单击
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param rect 点
|
|
|
|
* @param rect 点
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void mouseLeftClick(ViewPoint rect) {
|
|
|
|
public void mouseLeftClick(ViewPoint rect) {
|
|
|
|
mouseMove(rect);
|
|
|
|
mouseLeftClick(rect, 100);
|
|
|
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 鼠标左键单击
|
|
|
|
* 鼠标左键单击
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param rect 矩形区域
|
|
|
|
* @param rect 点
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void mouseLeftClick(ViewRect rect) {
|
|
|
|
public void mouseLeftClick(ViewPoint rect, long delay) {
|
|
|
|
mouseLeftClick(new ViewPoint(rect.getCenter().getX(), rect.getCenter().getY()));
|
|
|
|
mouseMove(rect);
|
|
|
|
|
|
|
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
|
|
|
delay(delay);
|
|
|
|
|
|
|
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|