|
@@ -200,20 +200,22 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, controller.getScale(), controller.getScale(),
|
|
|
null);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
if (doMark) {
|
|
|
- if (sx<x && sy<y) {
|
|
|
- g2.drawRect(sx, sy, x-sx, y-sy);
|
|
|
- } else if (sx>=x) {
|
|
|
- g2.drawRect(x, sy, sx-x, y-sy);
|
|
|
- } else if (sy>=y){
|
|
|
- g2.drawRect(sx, y, x-sx, sy-y);
|
|
|
- } else {
|
|
|
- g2.drawRect(x, y, 30, 30x);
|
|
|
+ g2.setColor(Color.BLACK);
|
|
|
+ g2.setStroke(new BasicStroke(1));
|
|
|
+ if (sx > x && sy > y) {
|
|
|
+ g2.drawRect(x, y, sx - x, sy - y);
|
|
|
+ } else if (sx < x && sy < y) {
|
|
|
+ g2.drawRect(sx, sy, x - sx, y - sy);
|
|
|
+ } else if (sx >= x) {
|
|
|
+ g2.drawRect(x, sy, sx - x, y - sy);
|
|
|
+ } else if (sy >= y) {
|
|
|
+ g2.drawRect(sx, y, x - sx, sy - y);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -240,11 +242,11 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
cy = cps.getPosition().y;
|
|
|
if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
|
|
|
tempCps = cps;
|
|
|
+ dragging = true;
|
|
|
|
|
|
if (tempCps.getClass() == HolonObject.class) {
|
|
|
HolonObject tempObj = ((HolonObject) tempCps);
|
|
|
dataSelected = tempObj.getElements();
|
|
|
- dragging = true;
|
|
|
}
|
|
|
if (e.isControlDown()) {
|
|
|
drawEdge = true;
|
|
@@ -258,7 +260,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
controller.setSelecteEdge(edgeHighlight);
|
|
|
}
|
|
|
|
|
|
- if (edgeHighlight == null) {
|
|
|
+ if (edgeHighlight == null && tempCps == null) {
|
|
|
sx = e.getX();
|
|
|
sy = e.getY();
|
|
|
doMark = true;
|