Skip to content

Commit 14707bb

Browse files
committed
Implement variable copy-pasting with nodes.
1 parent 47ba87d commit 14707bb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/src/api/custom_component.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class ComponentData with EquatableMixin, SerializableMixin {
9595
/// instance.
9696
final Map<String, dynamic> nodes;
9797

98+
/// Node ID -> variables.
99+
final Map<String, Set<VariableData>> variables;
100+
98101
/// Returns containing rect of the component.
99102
RectC get rect => RectC.fromLTWH(0, 0, width, height);
100103

@@ -103,11 +106,12 @@ class ComponentData with EquatableMixin, SerializableMixin {
103106
required this.width,
104107
required this.height,
105108
required this.nodes,
109+
this.variables = const {},
106110
}) : assert(nodes.isNotEmpty),
107111
assert(width > 0 && height > 0);
108112

109113
@override
110-
List<Object?> get props => [width, height, nodes];
114+
List<Object?> get props => [width, height, nodes, variables];
111115

112116
@override
113117
Map toJson() => _$ComponentDataToJson(this);
@@ -122,10 +126,12 @@ class ComponentData with EquatableMixin, SerializableMixin {
122126
double? width,
123127
double? height,
124128
Map<String, dynamic>? nodes,
129+
Map<String, Set<VariableData>>? variables,
125130
}) =>
126131
ComponentData(
127132
width: width ?? this.width,
128133
height: height ?? this.height,
129134
nodes: nodes ?? this.nodes,
135+
variables: variables ?? this.variables,
130136
);
131137
}

lib/src/api/custom_component.g.dart

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)