mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Various improvements
This commit is contained in:
parent
ea2d3dd553
commit
c29cb46ef7
@ -231,22 +231,26 @@ final class PhoneDemoComponent: Component {
|
||||
var mappedPosition = environment[DemoPageEnvironment.self].position
|
||||
mappedPosition *= abs(mappedPosition)
|
||||
|
||||
let scale: CGFloat = availableSize.width / 390.0
|
||||
|
||||
let phoneX = mappedPosition * 50.0 * scale
|
||||
let phoneY: CGFloat
|
||||
switch component.position {
|
||||
case .top:
|
||||
phoneY = phoneSize.height / 2.0 + 24.0 + abs(mappedPosition) * 24.0
|
||||
phoneY = availableSize.height + (-phoneSize.height / 2.0 + 24.0 + 149.0 + abs(mappedPosition) * 24.0) * scale
|
||||
case .bottom:
|
||||
phoneY = availableSize.height - phoneSize.height / 2.0 - 24.0 - abs(mappedPosition) * 24.0
|
||||
phoneY = (-149.0 + phoneSize.height / 2.0 - 24.0 - abs(mappedPosition) * 24.0) * scale
|
||||
}
|
||||
|
||||
|
||||
let isVisible = environment[DemoPageEnvironment.self].isDisplaying
|
||||
let isCentral = environment[DemoPageEnvironment.self].isCentral
|
||||
self.isCentral = isCentral
|
||||
|
||||
self.phoneView.center = CGPoint(x: availableSize.width / 2.0 + mappedPosition * 50.0, y: phoneY)
|
||||
self.phoneView.center = CGPoint(x: availableSize.width / 2.0 + phoneX, y: phoneY)
|
||||
self.phoneView.screenRotation = mappedPosition * -0.7
|
||||
|
||||
var perspective = CATransform3DIdentity
|
||||
var perspective = CATransform3DMakeScale(scale, scale, 1.0)
|
||||
perspective.m34 = mappedPosition / 50.0
|
||||
self.phoneView.layer.transform = CATransform3DRotate(perspective, 0.1, 0, 1, 0)
|
||||
|
||||
|
@ -855,7 +855,7 @@ private final class DemoSheetContent: CombinedComponent {
|
||||
transition: context.transition
|
||||
)
|
||||
|
||||
var contentHeight: CGFloat = context.availableSize.width + 154.0
|
||||
var contentHeight: CGFloat = context.availableSize.width + 146.0
|
||||
if case .other = component.source {
|
||||
contentHeight -= 40.0
|
||||
}
|
||||
@ -865,7 +865,9 @@ private final class DemoSheetContent: CombinedComponent {
|
||||
.position(CGPoint(x: buttonFrame.midX, y: buttonFrame.midY))
|
||||
)
|
||||
|
||||
let contentSize = CGSize(width: context.availableSize.width, height: buttonFrame.maxY + 5.0 + environment.safeInsets.bottom)
|
||||
let bottomPanelPadding: CGFloat = 12.0
|
||||
let bottomInset: CGFloat = environment.safeInsets.bottom > 0.0 ? environment.safeInsets.bottom + 5.0 : bottomPanelPadding
|
||||
let contentSize = CGSize(width: context.availableSize.width, height: buttonFrame.maxY + bottomInset)
|
||||
|
||||
return contentSize
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user