mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Fix back button
This commit is contained in:
parent
556e9bb430
commit
11b5940f07
@ -81,14 +81,27 @@ final class PeerInfoHeaderNavigationButtonContainerNode: SparseNode {
|
|||||||
}
|
}
|
||||||
let buttonSize = buttonNode.update(key: spec.key, presentationData: presentationData, height: size.height)
|
let buttonSize = buttonNode.update(key: spec.key, presentationData: presentationData, height: size.height)
|
||||||
var nextButtonOrigin = spec.isForExpandedView ? nextExpandedButtonOrigin : nextRegularButtonOrigin
|
var nextButtonOrigin = spec.isForExpandedView ? nextExpandedButtonOrigin : nextRegularButtonOrigin
|
||||||
let buttonFrame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: expandOffset + (spec.isForExpandedView ? maximumExpandOffset : 0.0)), size: buttonSize)
|
|
||||||
|
let buttonY: CGFloat
|
||||||
|
if case .back = spec.key {
|
||||||
|
buttonY = 0.0
|
||||||
|
} else {
|
||||||
|
buttonY = expandOffset + (spec.isForExpandedView ? maximumExpandOffset : 0.0)
|
||||||
|
}
|
||||||
|
let buttonFrame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: buttonY), size: buttonSize)
|
||||||
|
|
||||||
nextButtonOrigin += buttonSize.width + 4.0
|
nextButtonOrigin += buttonSize.width + 4.0
|
||||||
if spec.isForExpandedView {
|
if spec.isForExpandedView {
|
||||||
nextExpandedButtonOrigin = nextButtonOrigin
|
nextExpandedButtonOrigin = nextButtonOrigin
|
||||||
} else {
|
} else {
|
||||||
nextRegularButtonOrigin = nextButtonOrigin
|
nextRegularButtonOrigin = nextButtonOrigin
|
||||||
}
|
}
|
||||||
let alphaFactor: CGFloat = spec.isForExpandedView ? expandFraction : (1.0 - expandFraction)
|
let alphaFactor: CGFloat
|
||||||
|
if case .back = spec.key {
|
||||||
|
alphaFactor = 1.0
|
||||||
|
} else {
|
||||||
|
alphaFactor = spec.isForExpandedView ? expandFraction : (1.0 - expandFraction)
|
||||||
|
}
|
||||||
if wasAdded {
|
if wasAdded {
|
||||||
buttonNode.frame = buttonFrame
|
buttonNode.frame = buttonFrame
|
||||||
buttonNode.alpha = 0.0
|
buttonNode.alpha = 0.0
|
||||||
@ -117,7 +130,13 @@ final class PeerInfoHeaderNavigationButtonContainerNode: SparseNode {
|
|||||||
if let buttonNode = self.leftButtonNodes[spec.key] {
|
if let buttonNode = self.leftButtonNodes[spec.key] {
|
||||||
let buttonSize = buttonNode.bounds.size
|
let buttonSize = buttonNode.bounds.size
|
||||||
var nextButtonOrigin = spec.isForExpandedView ? nextExpandedButtonOrigin : nextRegularButtonOrigin
|
var nextButtonOrigin = spec.isForExpandedView ? nextExpandedButtonOrigin : nextRegularButtonOrigin
|
||||||
let buttonFrame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: expandOffset + (spec.isForExpandedView ? maximumExpandOffset : 0.0)), size: buttonSize)
|
let buttonY: CGFloat
|
||||||
|
if case .back = spec.key {
|
||||||
|
buttonY = 0.0
|
||||||
|
} else {
|
||||||
|
buttonY = expandOffset + (spec.isForExpandedView ? maximumExpandOffset : 0.0)
|
||||||
|
}
|
||||||
|
let buttonFrame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: buttonY), size: buttonSize)
|
||||||
nextButtonOrigin += buttonSize.width + 4.0
|
nextButtonOrigin += buttonSize.width + 4.0
|
||||||
if spec.isForExpandedView {
|
if spec.isForExpandedView {
|
||||||
nextExpandedButtonOrigin = nextButtonOrigin
|
nextExpandedButtonOrigin = nextButtonOrigin
|
||||||
@ -125,7 +144,12 @@ final class PeerInfoHeaderNavigationButtonContainerNode: SparseNode {
|
|||||||
nextRegularButtonOrigin = nextButtonOrigin
|
nextRegularButtonOrigin = nextButtonOrigin
|
||||||
}
|
}
|
||||||
transition.updateFrameAdditiveToCenter(node: buttonNode, frame: buttonFrame)
|
transition.updateFrameAdditiveToCenter(node: buttonNode, frame: buttonFrame)
|
||||||
let alphaFactor: CGFloat = spec.isForExpandedView ? expandFraction : (1.0 - expandFraction)
|
let alphaFactor: CGFloat
|
||||||
|
if case .back = spec.key {
|
||||||
|
alphaFactor = 1.0
|
||||||
|
} else {
|
||||||
|
alphaFactor = spec.isForExpandedView ? expandFraction : (1.0 - expandFraction)
|
||||||
|
}
|
||||||
|
|
||||||
var buttonTransition = transition
|
var buttonTransition = transition
|
||||||
if case let .animated(duration, curve) = buttonTransition, alphaFactor == 0.0 {
|
if case let .animated(duration, curve) = buttonTransition, alphaFactor == 0.0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user