File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ public final class Geometry: Hashable {
1717 public let children : [ Geometry ]
1818 public let isOpaque : Bool // Computed
1919 public let sourceLocation : SourceLocation ?
20+ public private( set) weak var parent : Geometry ?
2021
2122 public func hash( into hasher: inout Hasher ) {
2223 hasher. combine ( type)
@@ -232,6 +233,9 @@ public final class Geometry: Hashable {
232233
233234 // Must be set after cache key is generated
234235 self . isOpaque = isOpaque
236+
237+ // Must be set after all other properties
238+ children. forEach { $0. parent = self }
235239 }
236240}
237241
@@ -265,6 +269,10 @@ public extension Geometry {
265269 }
266270 }
267271
272+ var worldTransform : Transform {
273+ ( parent? . worldTransform ?? . identity) * transform
274+ }
275+
268276 internal func gatherNamedObjects( _ dictionary: inout [ String : Geometry ] ) {
269277 if let name = self . name {
270278 dictionary [ name] = self
You can’t perform that action at this time.
0 commit comments