Drawing improvements

This commit is contained in:
Ilya Laktyushin
2023-01-03 05:15:36 +04:00
parent afe3c2bd6b
commit 076129348b
5 changed files with 315 additions and 139 deletions

View File

@@ -27,6 +27,26 @@ enum DrawingTextStyle: Equatable {
}
}
enum DrawingTextAnimation: Equatable {
case none
case typing
case wiggle
case zoomIn
init(animation: DrawingTextEntity.Animation) {
switch animation {
case .none:
self = .none
case .typing:
self = .typing
case .wiggle:
self = .wiggle
case .zoomIn:
self = .zoomIn
}
}
}
enum DrawingTextAlignment: Equatable {
case left
case center
@@ -266,6 +286,7 @@ final class TextFontComponent: Component {
final class TextSettingsComponent: CombinedComponent {
let color: DrawingColor?
let style: DrawingTextStyle
let animation: DrawingTextAnimation
let alignment: DrawingTextAlignment
let font: DrawingTextFont
let isEmojiKeyboard: Bool
@@ -277,6 +298,7 @@ final class TextSettingsComponent: CombinedComponent {
let updateFastColorPickerPan: (CGPoint) -> Void
let dismissFastColorPicker: () -> Void
let toggleStyle: () -> Void
let toggleAnimation: () -> Void
let toggleAlignment: () -> Void
let presentFontPicker: () -> Void
let toggleKeyboard: (() -> Void)?
@@ -284,6 +306,7 @@ final class TextSettingsComponent: CombinedComponent {
init(
color: DrawingColor?,
style: DrawingTextStyle,
animation: DrawingTextAnimation,
alignment: DrawingTextAlignment,
font: DrawingTextFont,
isEmojiKeyboard: Bool,
@@ -294,12 +317,14 @@ final class TextSettingsComponent: CombinedComponent {
updateFastColorPickerPan: @escaping (CGPoint) -> Void = { _ in },
dismissFastColorPicker: @escaping () -> Void = {},
toggleStyle: @escaping () -> Void,
toggleAnimation: @escaping () -> Void,
toggleAlignment: @escaping () -> Void,
presentFontPicker: @escaping () -> Void,
toggleKeyboard: (() -> Void)?
) {
self.color = color
self.style = style
self.animation = animation
self.alignment = alignment
self.font = font
self.isEmojiKeyboard = isEmojiKeyboard
@@ -310,6 +335,7 @@ final class TextSettingsComponent: CombinedComponent {
self.updateFastColorPickerPan = updateFastColorPickerPan
self.dismissFastColorPicker = dismissFastColorPicker
self.toggleStyle = toggleStyle
self.toggleAnimation = toggleAnimation
self.toggleAlignment = toggleAlignment
self.presentFontPicker = presentFontPicker
self.toggleKeyboard = toggleKeyboard
@@ -322,6 +348,9 @@ final class TextSettingsComponent: CombinedComponent {
if lhs.style != rhs.style {
return false
}
if lhs.animation != rhs.animation {
return false
}
if lhs.alignment != rhs.alignment {
return false
}