Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Clicks on an empty place in a canvas
- *
- * @param canvas diagram pane to click on
- */
- public static void clickInDiagram(JComponentOperator canvas, boolean rightClick)
- {
- int pointCoo = 20;
- Point startPoint = new Point(pointCoo, pointCoo);
- DiagramPresentationElement activeDiagram = Application.getInstance().getProject().getActiveDiagram();
- // run through 1000 pixels
- for (int i = 0; i < 1000; i++)
- {
- PresentationElement element = activeDiagram.getPresentationElementAt(startPoint);
- if (element == null)
- {
- canvas.moveMouse(startPoint.x, startPoint.y);
- if (rightClick)
- {
- canvas.clickForPopup(startPoint.x, startPoint.y);
- }
- else
- {
- canvas.clickMouse(startPoint.x, startPoint.y, 1);
- }
- break;
- }
- else
- {
- pointCoo++;
- startPoint.setLocation(pointCoo, pointCoo);
- }
- }
- }
Add Comment
Please, Sign In to add comment