mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 09:45:25 +00:00
remove unused code
This commit is contained in:
@ -739,38 +739,6 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
return duplicated;
|
return duplicated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Layout a subtree rooted at node
|
|
||||||
void layoutSubtree(SpaceModel node, double startX, double startY) {
|
|
||||||
double calculateSubtreeWidth(SpaceModel n) {
|
|
||||||
if (n.children.isEmpty) return nodeWidth;
|
|
||||||
double width = 0;
|
|
||||||
for (var child in n.children) {
|
|
||||||
width += calculateSubtreeWidth(child) + horizontalGap;
|
|
||||||
}
|
|
||||||
return width - horizontalGap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void assignPositions(SpaceModel n, double x, double y) {
|
|
||||||
double subtreeWidth = calculateSubtreeWidth(n);
|
|
||||||
double centerX = x + subtreeWidth / 2 - nodeWidth / 2;
|
|
||||||
n.position = Offset(centerX, y);
|
|
||||||
|
|
||||||
if (n.children.length == 1) {
|
|
||||||
assignPositions(n.children.first, centerX, y + verticalGap);
|
|
||||||
} else {
|
|
||||||
double childX = x;
|
|
||||||
for (var child in n.children) {
|
|
||||||
double childWidth = calculateSubtreeWidth(child);
|
|
||||||
assignPositions(child, childX, y + verticalGap);
|
|
||||||
childX += childWidth + horizontalGap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double totalSubtreeWidth = calculateSubtreeWidth(node);
|
|
||||||
assignPositions(node, startX, startY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Actual duplication process
|
/// Actual duplication process
|
||||||
setState(() {
|
setState(() {
|
||||||
if (space.parent == null) {
|
if (space.parent == null) {
|
||||||
@ -797,41 +765,4 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _realignSubtree(SpaceModel parent) {
|
|
||||||
const double nodeWidth = 200;
|
|
||||||
const double horizontalGap = 60;
|
|
||||||
const double verticalGap = 180;
|
|
||||||
|
|
||||||
double calculateSubtreeWidth(SpaceModel node) {
|
|
||||||
if (node.children.isEmpty) return nodeWidth;
|
|
||||||
double width = 0;
|
|
||||||
for (var child in node.children) {
|
|
||||||
width += calculateSubtreeWidth(child) + horizontalGap;
|
|
||||||
}
|
|
||||||
return width - horizontalGap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void assignPositions(SpaceModel node, double startX, double startY) {
|
|
||||||
double subtreeWidth = calculateSubtreeWidth(node);
|
|
||||||
double centerX = startX + subtreeWidth / 2 - nodeWidth / 2;
|
|
||||||
node.position = Offset(centerX, startY);
|
|
||||||
|
|
||||||
if (node.children.length == 1) {
|
|
||||||
assignPositions(node.children.first, centerX, startY + verticalGap);
|
|
||||||
} else {
|
|
||||||
double childX = startX;
|
|
||||||
for (var child in node.children) {
|
|
||||||
double childWidth = calculateSubtreeWidth(child);
|
|
||||||
assignPositions(child, childX, startY + verticalGap);
|
|
||||||
childX += childWidth + horizontalGap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start laying out from parent
|
|
||||||
assignPositions(parent, parent.position.dx - 150, parent.position.dy);
|
|
||||||
|
|
||||||
_adjustCanvasSizeForSpaces();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user