diff --git a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift index 8f7e29d6db..0c6f7f3736 100644 --- a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift +++ b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift @@ -551,6 +551,19 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView { return nil } + public func getView(at point: CGPoint) -> DrawingEntityView? { + for case let view as DrawingEntityView in self.subviews { + if view is DrawingMediaEntityView { + continue + } + if view.frame.contains(point) { + return view + } + } + return nil + } + + public func eachView(_ f: (DrawingEntityView) -> Void) { for case let view as DrawingEntityView in self.subviews { f(view) @@ -762,9 +775,10 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView { } } } -// else if gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) { -// self.selectEntity(viewToSelect.entity) -// } + else if gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) { + self.selectEntity(viewToSelect.entity) + self.onInteractionUpdated(true) + } else if gestureRecognizer.numberOfTouches == 2, let mediaEntityView = self.subviews.first(where: { $0 is DrawingEntityMediaView }) as? DrawingEntityMediaView { mediaEntityView.handlePan(gestureRecognizer) } diff --git a/submodules/DrawingUI/Sources/DrawingTextEntity.swift b/submodules/DrawingUI/Sources/DrawingTextEntity.swift index 6597b1616e..fca26f09cd 100644 --- a/submodules/DrawingUI/Sources/DrawingTextEntity.swift +++ b/submodules/DrawingUI/Sources/DrawingTextEntity.swift @@ -629,7 +629,7 @@ public final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate self.textView.strokeColor = color self.textView.frameColor = nil } - self.textView.tintColor = cursorColor + self.textView.tintColor = self.textView.text.isEmpty ? .white : cursorColor if case .regular = self.textEntity.style { self.textView.layer.shadowColor = UIColor.black.cgColor diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index abd253aac0..4d01faf340 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -1774,6 +1774,10 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate { self.textView.view?.isHidden = false*/ } + var isActive: Bool { + return self.textField?.isFirstResponder ?? false + } + func deactivate() { if let text = self.textField?.text, !text.isEmpty { self.textField?.endEditing(true) @@ -5209,12 +5213,8 @@ public final class EmojiPagerContentComponent: Component { scrollView.layer.removeAllAnimations() } - if self.isSearchActivated, let component = self.component, component.searchState == .empty(hasResults: true), !component.searchAlwaysActive, let visibleSearchHeader = self.visibleSearchHeader, visibleSearchHeader.currentPresetSearchTerm == nil { - scrollView.isScrollEnabled = false - DispatchQueue.main.async { - scrollView.isScrollEnabled = true - } - self.visibleSearchHeader?.deactivate() + if let component = self.component, self.isSearchActivated, let visibleSearchHeader = self.visibleSearchHeader, visibleSearchHeader.isActive && !component.searchAlwaysActive { + visibleSearchHeader.deactivate() } self.component?.inputInteractionHolder.inputInteraction?.onScroll() self.component?.inputInteractionHolder.inputInteraction?.scrollingStickersGridPromise.set(true) diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index 8799882272..f0fa3733e2 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -2192,7 +2192,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate return false } if gestureRecognizer === self.dismissPanGestureRecognizer { - if self.isDisplayingTool || self.entitiesView.hasSelection { + let location = gestureRecognizer.location(in: self.entitiesView) + if self.isDisplayingTool || self.entitiesView.hasSelection || self.entitiesView.getView(at: location) != nil { return false } return true