Various improvements

This commit is contained in:
Ilya Laktyushin
2025-06-20 23:01:21 +02:00
parent 6e4660dbc0
commit 4d0d62075a
12 changed files with 420 additions and 156 deletions

View File

@@ -125,6 +125,7 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
var animateClippingFromContentAreaInScreenSpace: CGRect?
var storedGlobalFrame: CGRect?
var storedGlobalBoundsFrame: CGRect?
init(containingItem: ContextControllerTakeViewInfo.ContainingItem) {
self.offsetContainerNode = ASDisplayNode()
@@ -772,6 +773,12 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
switch stateTransition {
case .animateIn, .animateOut:
contentNode.storedGlobalFrame = convertFrame(contentNode.containingItem.contentRect, from: contentNode.containingItem.view, to: self.view)
var rect = convertFrame(contentNode.containingItem.view.bounds, from: contentNode.containingItem.view, to: self.view)
if rect.origin.x < 0.0 {
rect.origin.x += layout.size.width
}
contentNode.storedGlobalBoundsFrame = rect
case .none:
if contentNode.storedGlobalFrame == nil {
contentNode.storedGlobalFrame = convertFrame(contentNode.containingItem.contentRect, from: contentNode.containingItem.view, to: self.view)
@@ -803,13 +810,14 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
case .extracted:
if let contentNode = itemContentNode {
contentParentGlobalFrame = convertFrame(contentNode.containingItem.view.bounds, from: contentNode.containingItem.view, to: self.view)
if let frame = contentNode.storedGlobalBoundsFrame {
contentParentGlobalFrame.origin.x = frame.minX
}
let contentRectGlobalFrame = CGRect(origin: CGPoint(x: contentNode.containingItem.contentRect.minX, y: (contentNode.storedGlobalFrame?.maxY ?? 0.0) - contentNode.containingItem.contentRect.height), size: contentNode.containingItem.contentRect.size)
contentRect = CGRect(origin: CGPoint(x: contentRectGlobalFrame.minX, y: contentRectGlobalFrame.maxY - contentNode.containingItem.contentRect.size.height), size: contentNode.containingItem.contentRect.size)
if case .animateOut = stateTransition {
contentRect.origin.y = self.contentRectDebugNode.frame.maxY - contentRect.size.height
}
//contentRect.size.height = 200.0
} else {
return
}
@@ -1424,7 +1432,7 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
}
let currentContentScreenFrame: CGRect
switch self.source {
case let .location(location):
if let putBackInfo = location.transitionInfo() {
@@ -1454,6 +1462,9 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
if let contentNode = itemContentNode {
currentContentScreenFrame = convertFrame(contentNode.containingItem.contentRect, from: contentNode.containingItem.view, to: self.view)
if currentContentScreenFrame.origin.x < 0.0 {
contentParentGlobalFrameOffsetX = layout.size.width
}
} else {
return
}