Various fixes

This commit is contained in:
Ilya Laktyushin 2025-06-24 07:35:35 +02:00
parent 212164b072
commit 34372148fb
3 changed files with 20 additions and 9 deletions

View File

@ -88,12 +88,19 @@ public extension ComponentTransition.Update {
transition.setPosition(view: view, position: position) transition.setPosition(view: view, position: position)
transition.setScale(view: view, scale: scale) transition.setScale(view: view, scale: scale)
} else { } else {
if component._anchorPoint != nil { if view is UIScrollView {
view.bounds = CGRect(origin: CGPoint(), size: size) let frame = component.size.centered(around: component._position ?? CGPoint())
if view.frame != frame {
transition.setFrame(view: view, frame: frame)
}
} else { } else {
transition.setBounds(view: view, bounds: CGRect(origin: CGPoint(), size: size)) if component._anchorPoint != nil {
view.bounds = CGRect(origin: CGPoint(), size: size)
} else {
transition.setBounds(view: view, bounds: CGRect(origin: CGPoint(), size: size))
}
transition.setPosition(view: view, position: position)
} }
transition.setPosition(view: view, position: position)
} }
let opacity = component._opacity ?? 1.0 let opacity = component._opacity ?? 1.0
if view.alpha != opacity { if view.alpha != opacity {

View File

@ -724,11 +724,15 @@ public extension CombinedComponent {
updatedChild.view.center = updatedChild._position ?? CGPoint() updatedChild.view.center = updatedChild._position ?? CGPoint()
updatedChild.view.transform = CGAffineTransform(scaleX: scale, y: scale) updatedChild.view.transform = CGAffineTransform(scaleX: scale, y: scale)
} else { } else {
updatedChild.view.bounds = CGRect(origin: CGPoint(), size: updatedChild.size) if updatedChild.view is UIScrollView {
if updatedChild.view.layer.anchorPoint != CGPoint(x: 0.5, y: 0.5) { updatedChild.view.frame = updatedChild.size.centered(around: updatedChild._position ?? CGPoint())
updatedChild.view.layer.position = updatedChild._position ?? CGPoint()
} else { } else {
updatedChild.view.center = updatedChild._position ?? CGPoint() updatedChild.view.bounds = CGRect(origin: CGPoint(), size: updatedChild.size)
if updatedChild.view.layer.anchorPoint != CGPoint(x: 0.5, y: 0.5) {
updatedChild.view.layer.position = updatedChild._position ?? CGPoint()
} else {
updatedChild.view.center = updatedChild._position ?? CGPoint()
}
} }
} }

View File

@ -49,7 +49,7 @@ swift_library(
copts = [ copts = [
"-warnings-as-errors", "-warnings-as-errors",
], ],
data = [ data = [
":StoryPeerListBundle", ":StoryPeerListBundle",
], ],
deps = [ deps = [