mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-21 18:09:21 +03:00
Applying node transform directly to animation layer
This commit is contained in:
parent
e03eeaab66
commit
5607c47ff1
@ -21,17 +21,24 @@ class AnimationCache {
|
||||
guard let cachedLayer = layerCache[node] else {
|
||||
let layer = ShapeLayer()
|
||||
|
||||
// layer.backgroundColor = UIColor.greenColor().CGColor
|
||||
// layer.borderWidth = 1.0
|
||||
// layer.borderColor = UIColor.blueColor().CGColor
|
||||
layer.backgroundColor = UIColor.greenColor().CGColor
|
||||
layer.borderWidth = 1.0
|
||||
layer.borderColor = UIColor.blueColor().CGColor
|
||||
|
||||
if let shapeBounds = node.bounds() {
|
||||
let cgRect = shapeBounds.cgRect()
|
||||
|
||||
layer.bounds = cgRect
|
||||
let origFrame = CGRectMake(0.0, 0.0,
|
||||
cgRect.width + cgRect.origin.x,
|
||||
cgRect.height + cgRect.origin.y)
|
||||
|
||||
layer.bounds = origFrame
|
||||
layer.anchorPoint = CGPointMake(0.0, 0.0)
|
||||
|
||||
}
|
||||
|
||||
layer.transform = CATransform3DMakeAffineTransform(RenderUtils.mapTransform(node.pos))
|
||||
|
||||
layer.node = node
|
||||
layer.setNeedsDisplay()
|
||||
|
||||
|
@ -21,7 +21,12 @@ public class Group: Node {
|
||||
// GENERATED NOT
|
||||
override public func bounds() -> Rect? {
|
||||
|
||||
guard var union = contentsVar.first?.bounds() else {
|
||||
guard let firstPos = contentsVar.first?.pos else {
|
||||
return .None
|
||||
}
|
||||
|
||||
guard var union = contentsVar.first?.bounds()?.applyTransform(firstPos) else {
|
||||
|
||||
return .None
|
||||
}
|
||||
|
||||
@ -30,7 +35,7 @@ public class Group: Node {
|
||||
return
|
||||
}
|
||||
|
||||
union = union.union(nodeBounds)
|
||||
union = union.union(nodeBounds.applyTransform(node.pos))
|
||||
}
|
||||
|
||||
return union
|
||||
|
@ -67,7 +67,7 @@ public class Shape: Node {
|
||||
bounds = form.bounds()
|
||||
}
|
||||
|
||||
return bounds.applyTransform(self.pos)
|
||||
return bounds
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user