Various fixes

This commit is contained in:
Ilya Laktyushin
2023-01-01 02:08:27 +04:00
parent 96b4880961
commit 68a13a4c07
4 changed files with 18 additions and 6 deletions

View File

@@ -769,8 +769,14 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
if let reactionContextNode = self.reactionContextNode { if let reactionContextNode = self.reactionContextNode {
additionalVisibleOffsetY += reactionContextNode.visibleExtensionDistance additionalVisibleOffsetY += reactionContextNode.visibleExtensionDistance
} }
if case .reference = self.source { if case let .reference(source) = self.source {
if actionsFrame.maxY > layout.size.height { var actionsFrameIsOutOfScreen = false
if let contentAreaInScreenSpace = source.transitionInfo()?.contentAreaInScreenSpace {
if !contentAreaInScreenSpace.contains(actionsFrame) {
actionsFrameIsOutOfScreen = true
}
}
if actionsFrame.maxY > layout.size.height || actionsFrameIsOutOfScreen {
actionsFrame.origin.y = contentRect.minY - actionsSize.height - contentActionsSpacing actionsFrame.origin.y = contentRect.minY - actionsSize.height - contentActionsSpacing
} }
} }

View File

@@ -237,7 +237,6 @@ final class PenTool: DrawingElement {
var renderArrowLineWidth: CGFloat var renderArrowLineWidth: CGFloat
let isEraser: Bool let isEraser: Bool
let isBlur: Bool let isBlur: Bool
var arrowStart: CGPoint? var arrowStart: CGPoint?
@@ -277,7 +276,12 @@ final class PenTool: DrawingElement {
} }
var bounds: CGRect { var bounds: CGRect {
return normalizeDrawingRect(boundingRect(from: 0, to: self.segments.count).insetBy(dx: -20.0, dy: -20.0), drawingSize: self.drawingSize) let segmentsBounds = boundingRect(from: 0, to: self.segments.count).insetBy(dx: -20.0, dy: -20.0)
var combinedBounds = segmentsBounds
if self.hasArrow, let arrowLeftPath, let arrowRightPath {
combinedBounds = combinedBounds.union(arrowLeftPath.bounds).union(arrowRightPath.bounds).insetBy(dx: -20.0, dy: -20.0)
}
return normalizeDrawingRect(combinedBounds, drawingSize: self.drawingSize)
} }
required init(drawingSize: CGSize, color: DrawingColor, lineWidth: CGFloat, hasArrow: Bool, isEraser: Bool, isBlur: Bool, blurredImage: UIImage?) { required init(drawingSize: CGSize, color: DrawingColor, lineWidth: CGFloat, hasArrow: Bool, isEraser: Bool, isBlur: Bool, blurredImage: UIImage?) {

View File

@@ -359,7 +359,7 @@ private final class ReferenceContentSource: ContextReferenceContentSource {
} }
func transitionInfo() -> ContextControllerReferenceViewInfo? { func transitionInfo() -> ContextControllerReferenceViewInfo? {
return ContextControllerReferenceViewInfo(referenceView: self.sourceView, contentAreaInScreenSpace: self.contentArea, customPosition: customPosition) return ContextControllerReferenceViewInfo(referenceView: self.sourceView, contentAreaInScreenSpace: self.contentArea, customPosition: self.customPosition)
} }
} }

View File

@@ -363,7 +363,9 @@
_landscapeToolbarView.cancelPressed = toolbarCancelPressed; _landscapeToolbarView.cancelPressed = toolbarCancelPressed;
_landscapeToolbarView.donePressed = toolbarDonePressed; _landscapeToolbarView.donePressed = toolbarDonePressed;
_landscapeToolbarView.doneLongPressed = toolbarDoneLongPressed; _landscapeToolbarView.doneLongPressed = toolbarDoneLongPressed;
[_wrapperView addSubview:_landscapeToolbarView];
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad)
[_wrapperView addSubview:_landscapeToolbarView];
} }
return self; return self;
} }