X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Fnodes%2FDistrictNetworkStaticInfoNode.java;h=523f7e805cc8c5cd73e6ebbf8d0f935df2f4e0bb;hb=e6b35994e05232dd536af4da224a342c1bd090af;hp=4ce35a27344450de02942cf3607036829f64f20c;hpb=386525ce8e466427df0624a304ebb64df249d1bb;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java index 4ce35a27..523f7e80 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java @@ -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; @@ -86,7 +84,7 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo int ascent = fm.getMaxAscent(); g.transform(AffineTransform.getRotateInstance(direction.getX(), direction.getY())); - g.translate(0, ascent); + g.translate(0, ascent+2); // int height = fm.getHeight(); // g.setColor(Color.WHITE); @@ -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; } }