Fix wallpaper motion

This commit is contained in:
Ilya Laktyushin 2019-11-30 10:13:18 +04:00
parent 8614bc0d3e
commit 9b7fa8b24c

View File

@ -27,7 +27,9 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
self.contentNode.view.removeMotionEffect(effect)
}
}
self.updateScale()
if !self.frame.isEmpty {
self.updateScale()
}
}
}
}
@ -67,7 +69,12 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
}
public func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) {
let isFirstLayout = self.frame.isEmpty
transition.updatePosition(node: self.contentNode, position: CGPoint(x: size.width / 2.0, y: size.height / 2.0))
transition.updateBounds(node: self.contentNode, bounds: CGRect(origin: CGPoint(), size: size))
if isFirstLayout && !self.frame.isEmpty {
self.updateScale()
}
}
}