mirror of
https://github.com/exyte/Macaw.git
synced 2024-11-13 13:14:20 +03:00
Group contents parents fix. Fixes #95
This commit is contained in:
parent
bec2f10c0d
commit
8eb9ed6470
@ -5,7 +5,19 @@ open class Group: Node {
|
||||
open var contentsVar: AnimatableVariable<[Node]>
|
||||
open var contents: [Node] {
|
||||
get { return contentsVar.value }
|
||||
set(val) { contentsVar.value = val }
|
||||
set(val) {
|
||||
contentsVar.value = val
|
||||
|
||||
if let view = nodesMap.getView(self) {
|
||||
val.forEach { subNode in
|
||||
nodesMap.add(subNode, view: view)
|
||||
}
|
||||
}
|
||||
|
||||
val.forEach { subNode in
|
||||
nodesMap.add(subNode, parent: self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,6 +35,12 @@ class NodesMap {
|
||||
} else {
|
||||
parentsMap[node] = Set([parent])
|
||||
}
|
||||
|
||||
if let group = node as? Group {
|
||||
group.contents.forEach { child in
|
||||
self.add(child, parent: node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parents(_ node: Node) -> [Node] {
|
||||
|
Loading…
Reference in New Issue
Block a user