Various fixes

This commit is contained in:
Ilya Laktyushin 2023-08-06 20:37:11 +02:00
parent eb66f51388
commit 94599bb59e
5 changed files with 14 additions and 5 deletions

View File

@ -76,6 +76,8 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
var entityAdded: (DrawingEntity) -> Void = { _ in }
var entityRemoved: (DrawingEntity) -> Void = { _ in }
var autoSelectEntities = false
private let topEdgeView = UIView()
private let leftEdgeView = UIView()
@ -813,7 +815,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
}
}
}
else if gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) {
else if self.autoSelectEntities, gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) {
self.selectEntity(viewToSelect.entity, animate: false)
self.onInteractionUpdated(true)
}

View File

@ -2423,6 +2423,7 @@ public class DrawingScreen: ViewController, TGPhotoDrawingInterfaceController, U
contentWrapperView: self.contentWrapperView,
selectionContainerView: self.selectionContainerView,
isVideo: controller.isVideo,
autoselectEntityOnPan: false,
updateSelectedEntity: { [weak self] entity in
if let self {
self.updateSelectedEntity.invoke(entity)
@ -2956,6 +2957,7 @@ public final class DrawingToolsInteraction {
private weak var contentWrapperView: UIView?
private let selectionContainerView: DrawingSelectionContainerView
private let isVideo: Bool
private let autoSelectEntityOnPan: Bool
private let updateSelectedEntity: (DrawingEntity?) -> Void
private let updateVideoPlayback: (Bool) -> Void
private let updateColor: (DrawingColor) -> Void
@ -2987,6 +2989,7 @@ public final class DrawingToolsInteraction {
contentWrapperView: UIView,
selectionContainerView: DrawingSelectionContainerView,
isVideo: Bool,
autoselectEntityOnPan: Bool,
updateSelectedEntity: @escaping (DrawingEntity?) -> Void,
updateVideoPlayback: @escaping (Bool) -> Void,
updateColor: @escaping (DrawingColor) -> Void,
@ -3004,6 +3007,7 @@ public final class DrawingToolsInteraction {
self.contentWrapperView = contentWrapperView
self.selectionContainerView = selectionContainerView
self.isVideo = isVideo
self.autoSelectEntityOnPan = autoselectEntityOnPan
self.updateSelectedEntity = updateSelectedEntity
self.updateVideoPlayback = updateVideoPlayback
self.updateColor = updateColor
@ -3028,6 +3032,7 @@ public final class DrawingToolsInteraction {
public func activate() {
self.isActive = true
self.entitiesView.autoSelectEntities = self.autoSelectEntityOnPan
self.entitiesView.selectionContainerView = self.selectionContainerView
self.entitiesView.selectionChanged = { [weak self] entity in
if let self {

View File

@ -1992,6 +1992,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
contentWrapperView: self.previewContainerView,
selectionContainerView: self.selectionContainerView,
isVideo: false,
autoselectEntityOnPan: true,
updateSelectedEntity: { [weak self] _ in
if let self {
self.requestUpdate(transition: .easeInOut(duration: 0.2))

View File

@ -235,6 +235,7 @@ public final class PeerListItemComponent: Component {
self.avatarNode = AvatarNode(font: avatarFont)
self.avatarNode.isLayerBacked = false
self.avatarNode.isUserInteractionEnabled = false
self.avatarButtonView = HighlightTrackingButton()
@ -359,8 +360,6 @@ public final class PeerListItemComponent: Component {
let themeUpdated = self.component?.theme !== component.theme
self.avatarButtonView.isUserInteractionEnabled = component.openStories != nil
var hasSelectionUpdated = false
if let previousComponent = self.component {
switch previousComponent.selectionState {
@ -397,7 +396,7 @@ public final class PeerListItemComponent: Component {
self.component = component
self.state = state
self.avatarButtonView.isUserInteractionEnabled = component.storyStats != nil
self.avatarButtonView.isUserInteractionEnabled = component.storyStats != nil && component.openStories != nil
let labelData: (String, Bool)
if let presence = component.presence {

View File

@ -855,7 +855,9 @@ public final class StoryPeerListItemComponent: Component {
self?.indicatorShapeSeenLayer.animateShapeLineWidth(from: targetLineWidth, to: initialLineWidth, duration: 0.15)
})
HapticFeedback().success()
if self.window != nil {
HapticFeedback().success()
}
}
let titleSize = self.title.update(