]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java
Support copying of attributes from DN.MappedComponent
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / nodes / NetworkDrawingNode.java
index 00728e894e5f64c398c57ec3e86b953bff5bd81c..b94639e2311080c9881044f0228a4c06e14bbc6d 100644 (file)
@@ -55,8 +55,6 @@ public class NetworkDrawingNode extends G2DNode {
 
     private Resource diagramResource;
 
-    private boolean committed;
-
     private NetworkDrawingParticipant participant;
 
     private IDiagram diagram;
@@ -67,6 +65,7 @@ public class NetworkDrawingNode extends G2DNode {
             4.0f, new float[]{4.0f}, 0.0f);
 
     private static final Color BLUE_ALPHA = new Color(0, 0, 255, 100);
+    private static final Color RED_ALPHA = new Color(255, 0, 0, 100);
 
     private boolean scaleStroke = true;
     
@@ -123,8 +122,13 @@ public class NetworkDrawingNode extends G2DNode {
             }
             
             g2d.setColor(BLUE_ALPHA);
-
             g2d.draw(path);
+            
+            g2d.setColor(RED_ALPHA);
+            BasicStroke stroke = GeometryUtils.scaleStroke(DASHED_STROKE, (float) (1.0 / GeometryUtils.getScale(g2d.getTransform())));
+            g2d.setStroke(stroke);
+            Point2D currentPoint = path.getCurrentPoint();
+            g2d.draw(new Rectangle2D.Double(currentPoint.getX() - 0.0001 / 2, currentPoint.getY() - 0.0001 / 2, 0.0001, 0.0001));
         }
         
         g2d.setStroke(oldStroke);
@@ -232,10 +236,6 @@ public class NetworkDrawingNode extends G2DNode {
         // check ToolMode
         IToolMode mode = getToolMode();
         if (mode == Hints.CONNECTTOOL || e.hasAnyModifier(MouseEvent.ALT_MASK | MouseEvent.ALT_GRAPH_MASK)) {
-            if (committed) {
-                committed = false;
-                return false;
-            }
             if (e.button == MouseEvent.RIGHT_BUTTON && !nodes.isEmpty()) {
                 nodes.remove(nodes.size() - 1);
             } else if (e.button == MouseEvent.LEFT_BUTTON) {
@@ -254,7 +254,6 @@ public class NetworkDrawingNode extends G2DNode {
                     }
                     currentRouteNode = null;
                     nodes.clear();
-                    committed = true;
                 } else if (currentRouteNode != null) {
                     currentRouteNode.routeNodes.add(new Point2D.Double(localPos.getX(), localPos.getY()));
                 }