mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
c546c596d2
commit
92b30ddf23
@ -530,9 +530,17 @@ public final class LocationViewController: ViewController {
|
||||
self.controllerNode.showAll()
|
||||
}
|
||||
|
||||
private var didDismiss = false
|
||||
public override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
if !self.didDismiss {
|
||||
self.didDismiss = true
|
||||
self.dismissed()
|
||||
}
|
||||
}
|
||||
|
||||
public override func dismiss(completion: (() -> Void)? = nil) {
|
||||
super.dismiss(completion: completion)
|
||||
self.dismissed()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,10 @@ public enum CodableDrawingEntity: Equatable {
|
||||
case let .location(entity):
|
||||
return .venue(
|
||||
coordinates: MediaArea.Coordinates(
|
||||
x: entity.position.x / 1080.0 * 100.0,
|
||||
y: entity.position.y / 1920.0 * 100.0,
|
||||
width: (entity.renderImage?.size.width ?? 0.0) * entity.scale / 1080.0 * 100.0,
|
||||
height: (entity.renderImage?.size.height ?? 0.0) * entity.scale / 1920.0 * 100.0,
|
||||
x: entity.position.x / 1080.0,
|
||||
y: entity.position.y / 1920.0,
|
||||
width: (entity.renderImage?.size.width ?? 0.0) * entity.scale / 1080.0,
|
||||
height: (entity.renderImage?.size.height ?? 0.0) * entity.scale / 1920.0,
|
||||
rotation: entity.rotation / .pi * 180.0
|
||||
),
|
||||
venue: MediaArea.Venue(
|
||||
|
@ -795,8 +795,8 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
var selectedMediaArea: MediaArea?
|
||||
|
||||
func isPoint(_ point: CGPoint, in area: MediaArea) -> Bool {
|
||||
let tx = point.x - area.coordinates.x / 100.0 * referenceSize.width
|
||||
let ty = point.y - area.coordinates.y / 100.0 * referenceSize.height
|
||||
let tx = point.x - area.coordinates.x * referenceSize.width
|
||||
let ty = point.y - area.coordinates.y * referenceSize.height
|
||||
|
||||
let rad = -area.coordinates.rotation * Double.pi / 180.0
|
||||
let cosTheta = cos(rad)
|
||||
@ -804,7 +804,7 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
let rotatedX = tx * cosTheta - ty * sinTheta
|
||||
let rotatedY = tx * sinTheta + ty * cosTheta
|
||||
|
||||
return abs(rotatedX) <= area.coordinates.width / 100.0 * referenceSize.width / 2.0 && abs(rotatedY) <= area.coordinates.height / 100.0 * referenceSize.height / 2.0
|
||||
return abs(rotatedX) <= area.coordinates.width * referenceSize.width / 2.0 && abs(rotatedY) <= area.coordinates.height * referenceSize.height / 2.0
|
||||
}
|
||||
|
||||
for area in component.slice.item.storyItem.mediaAreas {
|
||||
|
@ -3113,7 +3113,9 @@ final class StoryItemSetContainerSendMessage {
|
||||
view?.updateModalTransitionFactor(1.0, transition: .animated(duration: 0.5, curve: .spring))
|
||||
locationController.dismissed = { [weak view] in
|
||||
view?.updateModalTransitionFactor(0.0, transition: .animated(duration: 0.5, curve: .spring))
|
||||
view?.updateIsProgressPaused()
|
||||
Queue.mainQueue().after(0.3, {
|
||||
view?.updateIsProgressPaused()
|
||||
})
|
||||
}
|
||||
controller?.push(locationController)
|
||||
}))
|
||||
@ -3121,7 +3123,7 @@ final class StoryItemSetContainerSendMessage {
|
||||
|
||||
let referenceSize = view.controlsContainerView.frame.size
|
||||
let size = CGSize(width: 16.0, height: 16.0)
|
||||
var frame = CGRect(x: mediaArea.coordinates.x / 100.0 * referenceSize.width - size.width / 2.0, y: (mediaArea.coordinates.y - mediaArea.coordinates.height * 0.5) / 100.0 * referenceSize.height - size.height / 2.0, width: size.width, height: size.height)
|
||||
var frame = CGRect(x: mediaArea.coordinates.x * referenceSize.width - size.width / 2.0, y: (mediaArea.coordinates.y - mediaArea.coordinates.height * 0.5) * referenceSize.height - size.height / 2.0, width: size.width, height: size.height)
|
||||
frame = frame.offsetBy(dx: 0.0, dy: view.controlsContainerView.frame.minY)
|
||||
|
||||
let node = controller.displayNode
|
||||
|
Loading…
x
Reference in New Issue
Block a user