mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
c9bddb58b5
commit
d4bf77376c
@ -551,6 +551,19 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
return nil
|
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) {
|
public func eachView(_ f: (DrawingEntityView) -> Void) {
|
||||||
for case let view as DrawingEntityView in self.subviews {
|
for case let view as DrawingEntityView in self.subviews {
|
||||||
f(view)
|
f(view)
|
||||||
@ -762,9 +775,10 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else if gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) {
|
else if gestureRecognizer.numberOfTouches == 1, let viewToSelect = self.entity(at: location) {
|
||||||
// self.selectEntity(viewToSelect.entity)
|
self.selectEntity(viewToSelect.entity)
|
||||||
// }
|
self.onInteractionUpdated(true)
|
||||||
|
}
|
||||||
else if gestureRecognizer.numberOfTouches == 2, let mediaEntityView = self.subviews.first(where: { $0 is DrawingEntityMediaView }) as? DrawingEntityMediaView {
|
else if gestureRecognizer.numberOfTouches == 2, let mediaEntityView = self.subviews.first(where: { $0 is DrawingEntityMediaView }) as? DrawingEntityMediaView {
|
||||||
mediaEntityView.handlePan(gestureRecognizer)
|
mediaEntityView.handlePan(gestureRecognizer)
|
||||||
}
|
}
|
||||||
|
@ -629,7 +629,7 @@ public final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate
|
|||||||
self.textView.strokeColor = color
|
self.textView.strokeColor = color
|
||||||
self.textView.frameColor = nil
|
self.textView.frameColor = nil
|
||||||
}
|
}
|
||||||
self.textView.tintColor = cursorColor
|
self.textView.tintColor = self.textView.text.isEmpty ? .white : cursorColor
|
||||||
|
|
||||||
if case .regular = self.textEntity.style {
|
if case .regular = self.textEntity.style {
|
||||||
self.textView.layer.shadowColor = UIColor.black.cgColor
|
self.textView.layer.shadowColor = UIColor.black.cgColor
|
||||||
|
@ -1774,6 +1774,10 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
|
|||||||
self.textView.view?.isHidden = false*/
|
self.textView.view?.isHidden = false*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isActive: Bool {
|
||||||
|
return self.textField?.isFirstResponder ?? false
|
||||||
|
}
|
||||||
|
|
||||||
func deactivate() {
|
func deactivate() {
|
||||||
if let text = self.textField?.text, !text.isEmpty {
|
if let text = self.textField?.text, !text.isEmpty {
|
||||||
self.textField?.endEditing(true)
|
self.textField?.endEditing(true)
|
||||||
@ -5209,12 +5213,8 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
scrollView.layer.removeAllAnimations()
|
scrollView.layer.removeAllAnimations()
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.isSearchActivated, let component = self.component, component.searchState == .empty(hasResults: true), !component.searchAlwaysActive, let visibleSearchHeader = self.visibleSearchHeader, visibleSearchHeader.currentPresetSearchTerm == nil {
|
if let component = self.component, self.isSearchActivated, let visibleSearchHeader = self.visibleSearchHeader, visibleSearchHeader.isActive && !component.searchAlwaysActive {
|
||||||
scrollView.isScrollEnabled = false
|
visibleSearchHeader.deactivate()
|
||||||
DispatchQueue.main.async {
|
|
||||||
scrollView.isScrollEnabled = true
|
|
||||||
}
|
|
||||||
self.visibleSearchHeader?.deactivate()
|
|
||||||
}
|
}
|
||||||
self.component?.inputInteractionHolder.inputInteraction?.onScroll()
|
self.component?.inputInteractionHolder.inputInteraction?.onScroll()
|
||||||
self.component?.inputInteractionHolder.inputInteraction?.scrollingStickersGridPromise.set(true)
|
self.component?.inputInteractionHolder.inputInteraction?.scrollingStickersGridPromise.set(true)
|
||||||
|
@ -2192,7 +2192,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if gestureRecognizer === self.dismissPanGestureRecognizer {
|
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 false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user