This commit is contained in:
Ali
2023-08-29 20:38:55 +04:00
parent fe3f5a4f54
commit 8130d9e937
35 changed files with 1326 additions and 245 deletions

View File

@@ -82,6 +82,7 @@ public final class LottieComponent: Component {
public let color: UIColor?
public let startingPosition: StartingPosition
public let size: CGSize?
public let renderingScale: CGFloat?
public let loop: Bool
public init(
@@ -89,12 +90,14 @@ public final class LottieComponent: Component {
color: UIColor? = nil,
startingPosition: StartingPosition = .end,
size: CGSize? = nil,
renderingScale: CGFloat? = nil,
loop: Bool = false
) {
self.content = content
self.color = color
self.startingPosition = startingPosition
self.size = size
self.renderingScale = renderingScale
self.loop = loop
}
@@ -111,6 +114,9 @@ public final class LottieComponent: Component {
if lhs.size != rhs.size {
return false
}
if lhs.renderingScale != rhs.renderingScale {
return false
}
if lhs.loop != rhs.loop {
return false
}
@@ -353,7 +359,9 @@ public final class LottieComponent: Component {
var redrawImage = false
let displaySize = CGSize(width: size.width * UIScreenScale, height: size.height * UIScreenScale)
let renderingScale = component.renderingScale ?? UIScreenScale
let displaySize = CGSize(width: size.width * renderingScale, height: size.height * renderingScale)
if self.currentDisplaySize != displaySize {
self.currentDisplaySize = displaySize
redrawImage = true