Disable reflection on pinch

This commit is contained in:
Isaac 2023-11-27 13:32:52 +04:00
parent e47e19980d
commit 3279ead8f1
3 changed files with 23 additions and 3 deletions

View File

@ -639,6 +639,9 @@ public final class AvatarListContentNode: ASDisplayNode {
let replicatorLayer = self.layer as! CAReplicatorLayer
replicatorLayer.instanceCount = 2
self.backgroundColor = nil
self.isOpaque = false
}
required init?(coder: NSCoder) {
@ -653,6 +656,17 @@ public final class AvatarListContentNode: ASDisplayNode {
let replicatorLayer = self.layer as! CAReplicatorLayer
replicatorLayer.instanceTransform = instanceTransform
}
func updateIsInPinchMode(_ value: Bool) {
let replicatorLayer = self.layer as! CAReplicatorLayer
if value {
replicatorLayer.instanceAlphaOffset = -1.0
} else {
replicatorLayer.instanceAlphaOffset = 0.0
replicatorLayer.animate(from: -1.0 as NSNumber, to: 1.0 as NSNumber, keyPath: "instanceAlphaOffset", timingFunction: CAMediaTimingFunctionName.linear.rawValue, duration: 0.3)
}
}
}
override public init() {
@ -666,6 +680,10 @@ public final class AvatarListContentNode: ASDisplayNode {
public func update(size: CGSize) {
(self.view as? View)?.update(size: size)
}
public func updateIsInPinchMode(_ value: Bool) {
(self.view as? View)?.updateIsInPinchMode(value)
}
}
public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
@ -933,7 +951,7 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
super.init()
self.backgroundColor = .black
//self.backgroundColor = .black
self.addSubnode(self.contentNode)

View File

@ -109,6 +109,7 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
context.sharedContext.mainWindow?.presentInGlobalOverlay(pinchController)
strongSelf.listContainerNode.bottomShadowNode.alpha = 0.0
strongSelf.listContainerNode.contentNode.updateIsInPinchMode(true)
}
self.pinchSourceNode.animatedOut = { [weak self] in
@ -116,6 +117,7 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
return
}
strongSelf.animateOverlaysFadeIn?()
strongSelf.listContainerNode.contentNode.updateIsInPinchMode(false)
}
self.listContainerNode.openStories = { [weak self] in

View File

@ -1104,9 +1104,9 @@ final class PeerInfoHeaderNode: ASDisplayNode {
let expandedTitleScale: CGFloat = 0.8
var bottomShadowHeight: CGFloat = 98.0
var bottomShadowHeight: CGFloat = 88.0
if !self.isSettings {
bottomShadowHeight += 80.0
bottomShadowHeight += 90.0
}
let bottomShadowFrame = CGRect(origin: CGPoint(x: 0.0, y: expandedAvatarHeight - bottomShadowHeight), size: CGSize(width: width, height: bottomShadowHeight))
transition.updateFrame(node: self.avatarListNode.listContainerNode.bottomShadowNode, frame: bottomShadowFrame, beginWithCurrentState: true)