Browse Source

设备节点锚点位置信息bug修复

zhaoyk 3 years ago
parent
commit
4c8ed8cec2

+ 1 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java

@@ -70,7 +70,7 @@ public class DiagramDataLoader {
 				}
 
 				//设置anchorLocations
-				en.getAnchorLocations();
+				en.setAnchorLocations();
 			}
 
 			if(obj != null) {

+ 9 - 8
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/EquipmentNode.java

@@ -56,7 +56,7 @@ public class EquipmentNode extends DiagramNode implements IDataBind {
 			label.setLocation(new XY(10, 10)); //TODO
 		}
 
-		//TODO anchors
+		setAnchorLocations();
 	}
 
 	@Override
@@ -115,15 +115,16 @@ public class EquipmentNode extends DiagramNode implements IDataBind {
 		return legend;
 	}
 
-	public Map<String, XY> getAnchorLocations() {
-		if (anchorLocations == null) {
-			if (legend.getAnchors() != null) {
-				anchorLocations = new HashMap<>();
-				for (Anchor anchor : legend.getAnchors()) {
-					anchorLocations.put(anchor.getCode(), anchor.calcLocation(size));
-				}
+	public void setAnchorLocations() {
+		if (legend.getAnchors() != null) {
+			anchorLocations = new HashMap<>();
+			for (Anchor anchor : legend.getAnchors()) {
+				anchorLocations.put(anchor.getCode(), anchor.calcLocation(size));
 			}
 		}
+	}
+
+	public Map<String, XY> getAnchorLocations() {
 		return anchorLocations;
 	}