Various improvements

This commit is contained in:
Ilya Laktyushin
2022-12-19 06:35:11 +04:00
parent 1d0f77fc3e
commit 0b37adc8b2
7 changed files with 382 additions and 420 deletions

View File

@@ -362,6 +362,7 @@ final class TextSettingsComponent: CombinedComponent {
let alignment: DrawingTextAlignment
let font: DrawingTextFont
let isEmojiKeyboard: Bool
let tag: AnyObject?
let presentColorPicker: () -> Void
let presentFastColorPicker: (GenericComponentViewTag) -> Void
@@ -378,6 +379,7 @@ final class TextSettingsComponent: CombinedComponent {
alignment: DrawingTextAlignment,
font: DrawingTextFont,
isEmojiKeyboard: Bool,
tag: AnyObject?,
presentColorPicker: @escaping () -> Void = {},
presentFastColorPicker: @escaping (GenericComponentViewTag) -> Void = { _ in },
updateFastColorPickerPan: @escaping (CGPoint) -> Void = { _ in },
@@ -392,6 +394,7 @@ final class TextSettingsComponent: CombinedComponent {
self.alignment = alignment
self.font = font
self.isEmojiKeyboard = isEmojiKeyboard
self.tag = tag
self.presentColorPicker = presentColorPicker
self.presentFastColorPicker = presentFastColorPicker
self.updateFastColorPickerPan = updateFastColorPickerPan
@@ -460,6 +463,25 @@ final class TextSettingsComponent: CombinedComponent {
State()
}
final class View: UIView, ComponentTaggedView {
var componentTag: AnyObject?
public func matches(tag: Any) -> Bool {
if let componentTag = self.componentTag {
let tag = tag as AnyObject
if componentTag === tag {
return true
}
}
return false
}
}
func makeView() -> View {
let view = View()
view.componentTag = self.tag
return view
}
static var body: Body {
let colorButton = Child(ColorSwatchComponent.self)
let colorButtonTag = GenericComponentViewTag()
@@ -723,6 +745,7 @@ final class TextSizeSliderComponent: Component {
if let size = self.validSize, let component = self.component {
let _ = self.updateLayout(size: size, component: component, transition: .easeInOut(duration: 0.2))
}
self.released()
default:
break
}