]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java
Interim fix for orientation/location of static info on network branches
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / nodes / DistrictNetworkStaticInfoNode.java
index c8eae515375b843d6879d17643e442461536bc2f..523f7e805cc8c5cd73e6ebbf8d0f935df2f4e0bb 100644 (file)
@@ -22,13 +22,11 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo
 
        private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, DPIUtil.upscale(10));
 
-       private static final Point2D UNIT_X = new Point2D.Double(1.0, 0.0);
-
        public static final String NODE_KEY = "DISTRICT_NETWORK_STATIC_INFO";
 
        String info = null;
        Point2D origin = new Point2D.Double();
-       Point2D direction = UNIT_X;
+       Point2D direction = new Point2D.Double();
 
        private DistrictNetworkEdgeNode edgeNode = null;
 
@@ -103,8 +101,8 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo
        }
 
        public void setLocation(Point2D origin, Point2D direction) {
-               this.origin = origin;
-               this.direction = direction;
+               this.origin.setLocation(origin);
+               this.direction.setLocation(direction);
        }
 
        public void setInfo(String info) {
@@ -113,5 +111,7 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo
 
        public void setEdgeNode(DistrictNetworkEdgeNode n) {
                this.edgeNode = n;
+               // Ensure that origin/location are recalculated
+               prevZoomLevel = -1;
        }
 }