diff --git a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift index 67a763fb8d..9558131325 100644 --- a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift +++ b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift @@ -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) } diff --git a/submodules/DrawingUI/Sources/DrawingScreen.swift b/submodules/DrawingUI/Sources/DrawingScreen.swift index b92e9a5907..48385363b9 100644 --- a/submodules/DrawingUI/Sources/DrawingScreen.swift +++ b/submodules/DrawingUI/Sources/DrawingScreen.swift @@ -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 { diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index 10b7527b97..a0a01f55f3 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -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)) diff --git a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift index ee3ad3d1a1..a564929778 100644 --- a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift @@ -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 { diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift index a9da59fc1f..b98a76a8ef 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift @@ -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(