mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
updated the duplicate
This commit is contained in:
@ -703,8 +703,28 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
}
|
||||
});
|
||||
|
||||
Offset childStartPosition = newPosition + Offset(0, verticalGap);
|
||||
final childrenWithDownDirection = original.children
|
||||
.where((child) =>
|
||||
child.incomingConnection?.direction == "down" &&
|
||||
child.status != SpaceStatus.deleted)
|
||||
.toList();
|
||||
|
||||
Offset childStartPosition = childrenWithDownDirection.length == 1
|
||||
? duplicated.position
|
||||
: newPosition + Offset(0, verticalGap);
|
||||
|
||||
for (final child in original.children) {
|
||||
final isDownDirection =
|
||||
child.incomingConnection?.direction == "down" ?? false;
|
||||
|
||||
if (isDownDirection && childrenWithDownDirection.length == 1) {
|
||||
// Place the only "down" child vertically aligned with the parent
|
||||
childStartPosition = duplicated.position + Offset(0, verticalGap);
|
||||
} else if (!isDownDirection) {
|
||||
// Position children with other directions horizontally
|
||||
childStartPosition = duplicated.position + Offset(horizontalGap, 0);
|
||||
}
|
||||
|
||||
final duplicatedChild =
|
||||
duplicateRecursive(child, childStartPosition, duplicated);
|
||||
duplicated.children.add(duplicatedChild);
|
||||
|
@ -385,6 +385,15 @@ class AssignTagModelsDialog extends StatelessWidget {
|
||||
final modifiedTags = List<TagModel>.from(updatedTags);
|
||||
final modifiedSubspaces = List<SubspaceTemplateModel>.from(subspaces ?? []);
|
||||
|
||||
if (subspaces != null) {
|
||||
for (var subspace in subspaces) {
|
||||
subspace.tags?.removeWhere(
|
||||
(tag) => !modifiedTags
|
||||
.any((updatedTag) => updatedTag.internalId == tag.internalId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (var tag in modifiedTags.toList()) {
|
||||
if (modifiedSubspaces.isEmpty) continue;
|
||||
|
||||
@ -461,5 +470,4 @@ class AssignTagModelsDialog extends StatelessWidget {
|
||||
'subspaces': modifiedSubspaces,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user