mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Story location picking
This commit is contained in:
@@ -28,6 +28,8 @@ private func makeEntityView(context: AccountContext, entity: DrawingEntity) -> D
|
||||
return DrawingVectorEntityView(context: context, entity: entity)
|
||||
} else if let entity = entity as? DrawingMediaEntity {
|
||||
return DrawingMediaEntityView(context: context, entity: entity)
|
||||
} else if let entity = entity as? DrawingLocationEntity {
|
||||
return DrawingLocationEntityView(context: context, entity: entity)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
@@ -47,6 +49,9 @@ private func prepareForRendering(entityView: DrawingEntityView) {
|
||||
if let entityView = entityView as? DrawingVectorEntityView {
|
||||
entityView.entity.renderImage = entityView.getRenderImage()
|
||||
}
|
||||
if let entityView = entityView as? DrawingLocationEntityView {
|
||||
entityView.entity.renderImage = entityView.getRenderImage()
|
||||
}
|
||||
}
|
||||
|
||||
public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
@@ -347,6 +352,14 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
text.fontSize = 0.08
|
||||
text.scale = zoomScale
|
||||
}
|
||||
} else if let location = entity as? DrawingLocationEntity {
|
||||
location.position = center
|
||||
if setup {
|
||||
location.rotation = rotation
|
||||
location.referenceDrawingSize = self.size
|
||||
location.width = floor(self.size.width * 0.9)
|
||||
location.scale = zoomScale
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +666,9 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
selectionView.tapped = { [weak self, weak entityView] in
|
||||
if let self, let entityView {
|
||||
let entityViews = self.subviews.filter { $0 is DrawingEntityView }
|
||||
self.requestedMenuForEntityView(entityView, entityViews.last === entityView)
|
||||
if !entityView.selectedTapAction() {
|
||||
self.requestedMenuForEntityView(entityView, entityViews.last === entityView)
|
||||
}
|
||||
}
|
||||
}
|
||||
entityView.selectionView = selectionView
|
||||
@@ -912,6 +927,10 @@ public class DrawingEntityView: UIView {
|
||||
self.layer.animateKeyframes(values: values as [NSNumber], keyTimes: keyTimes as [NSNumber], duration: 0.3, keyPath: "transform.scale")
|
||||
}
|
||||
|
||||
func selectedTapAction() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
public func play() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user