@@ -53,22 +53,22 @@ class LayoutDesignerViewModel {
53
53
}
54
54
55
55
optionViewModels = [
56
- . init( title: " Min scale " , kind: . singleSlider( current: options. minScale) { n in
56
+ . init( title: " Min scale " , kind: . singleSlider( current: options. minScale, range : 0 ... 2 ) { n in
57
57
update { $0. minScale = n! }
58
58
} ) ,
59
- . init( title: " Max scale " , kind: . singleSlider( current: options. maxScale) { n in
59
+ . init( title: " Max scale " , kind: . singleSlider( current: options. maxScale, range : 0 ... 2 ) { n in
60
60
update { $0. maxScale = n! }
61
61
} ) ,
62
- . init( title: " Scale ratio " , kind: . singleSlider( current: options. scaleRatio) { n in
62
+ . init( title: " Scale ratio " , kind: . singleSlider( current: options. scaleRatio, range : 0 ... 2 ) { n in
63
63
update { $0. scaleRatio = n! }
64
64
} ) ,
65
- . init( title: " Translation ratio " , kind: . doubleSlider( current: options. translationRatio. pair) { n in
65
+ . init( title: " Translation ratio " , kind: . doubleSlider( current: options. translationRatio. pair, range : - 2 ... 2 ) { n in
66
66
update { $0. translationRatio = . by( pair: n!) }
67
67
} ) ,
68
- . init( title: " Min translation ratio " , kind: . doubleSlider( current: options. minTranslationRatio? . pair, optional: true ) { n in
68
+ . init( title: " Min translation ratio " , kind: . doubleSlider( current: options. minTranslationRatio? . pair, range : - 5 ... 5 , optional: true ) { n in
69
69
update { $0. minTranslationRatio = n. map { . by( pair: $0) } }
70
70
} ) ,
71
- . init( title: " Max translation ratio " , kind: . doubleSlider( current: options. maxTranslationRatio? . pair, optional: true ) { n in
71
+ . init( title: " Max translation ratio " , kind: . doubleSlider( current: options. maxTranslationRatio? . pair, range : - 5 ... 5 , optional: true ) { n in
72
72
update { $0. maxTranslationRatio = n. map { . by( pair: $0) } }
73
73
} ) ,
74
74
. init( title: " Keep vertical spacing equal " , kind: . toggleSwitch( current: options. keepVerticalSpacingEqual) { n in
@@ -79,6 +79,9 @@ class LayoutDesignerViewModel {
79
79
} ) ,
80
80
. init( title: " Scale curve " , kind: . segmented( options: TransformCurve . all. map ( \. name) , current: options. scaleCurve. name) { n in
81
81
update { $0. scaleCurve = . by( name: n) ! }
82
+ } ) ,
83
+ . init( title: " Translation curve " , kind: . segmented( options: TransformCurve . all. map ( \. name) , current: options. translationCurve. name) { n in
84
+ update { $0. translationCurve = . by( name: n) ! }
82
85
} )
83
86
]
84
87
} else if var options = selectedLayout. stackOptions {
@@ -88,7 +91,7 @@ class LayoutDesignerViewModel {
88
91
}
89
92
90
93
optionViewModels = [
91
- . init( title: " Scale factor " , kind: . singleSlider( current: options. scaleFactor) { n in
94
+ . init( title: " Scale factor " , kind: . singleSlider( current: options. scaleFactor, range : - 1 ... 1 ) { n in
92
95
update { $0. scaleFactor = n! }
93
96
} ) ,
94
97
. init( title: " Min scale " , kind: . singleSlider( current: options. minScale, optional: true ) { n in
@@ -97,7 +100,7 @@ class LayoutDesignerViewModel {
97
100
. init( title: " Max scale " , kind: . singleSlider( current: options. maxScale, optional: true ) { n in
98
101
update { $0. maxScale = n }
99
102
} ) ,
100
- . init( title: " Spacing factor " , kind: . singleSlider( current: options. spacingFactor) { n in
103
+ . init( title: " Spacing factor " , kind: . singleSlider( current: options. spacingFactor, range : 0 ... 0.5 ) { n in
101
104
update { $0. spacingFactor = n! }
102
105
} ) ,
103
106
. init( title: " Max spacing " , kind: . singleSlider( current: options. maxSpacing, optional: true ) { n in
@@ -106,13 +109,13 @@ class LayoutDesignerViewModel {
106
109
. init( title: " Alpha factor " , kind: . singleSlider( current: options. alphaFactor) { n in
107
110
update { $0. alphaFactor = n! }
108
111
} ) ,
109
- . init( title: " Bottom stack alpha speed factor " , kind: . singleSlider( current: options. bottomStackAlphaSpeedFactor) { n in
112
+ . init( title: " Bottom stack alpha speed factor " , kind: . singleSlider( current: options. bottomStackAlphaSpeedFactor, range : 0 ... 10 ) { n in
110
113
update { $0. bottomStackAlphaSpeedFactor = n! }
111
114
} ) ,
112
- . init( title: " Top stack alpha speed factor " , kind: . singleSlider( current: options. topStackAlphaSpeedFactor) { n in
115
+ . init( title: " Top stack alpha speed factor " , kind: . singleSlider( current: options. topStackAlphaSpeedFactor, range : 0 ... 10 ) { n in
113
116
update { $0. topStackAlphaSpeedFactor = n! }
114
117
} ) ,
115
- . init( title: " Perspective ratio " , kind: . singleSlider( current: options. perspectiveRatio) { n in
118
+ . init( title: " Perspective ratio " , kind: . singleSlider( current: options. perspectiveRatio, range : - 1 ... 1 ) { n in
116
119
update { $0. perspectiveRatio = n! }
117
120
} ) ,
118
121
. init( title: " Shadow enabled " , kind: . toggleSwitch( current: options. shadowEnabled) { n in
@@ -124,19 +127,19 @@ class LayoutDesignerViewModel {
124
127
. init( title: " Shadow offset " , kind: . doubleSlider( current: options. shadowOffset. pair) { n in
125
128
update { $0. shadowOffset = . by( pair: n!) }
126
129
} ) ,
127
- . init( title: " Shadow radius " , kind: . singleSlider( current: options. shadowRadius) { n in
130
+ . init( title: " Shadow radius " , kind: . singleSlider( current: options. shadowRadius, range : 1 ... 10 ) { n in
128
131
update { $0. shadowRadius = n! }
129
132
} ) ,
130
- . init( title: " Rotate angel " , kind: . singleSlider( current: options. stackRotateAngel) { n in
133
+ . init( title: " Rotate angel " , kind: . singleSlider( current: options. stackRotateAngel, range : - CGFloat . pi ... CGFloat . pi ) { n in
131
134
update { $0. stackRotateAngel = n! }
132
135
} ) ,
133
- . init( title: " Pop angle " , kind: . singleSlider( current: options. popAngle) { n in
136
+ . init( title: " Pop angle " , kind: . singleSlider( current: options. popAngle, range : - CGFloat . pi ... CGFloat . pi ) { n in
134
137
update { $0. popAngle = n! }
135
138
} ) ,
136
- . init( title: " Pop offset ratio " , kind: . doubleSlider( current: options. popOffsetRatio. pair) { n in
139
+ . init( title: " Pop offset ratio " , kind: . doubleSlider( current: options. popOffsetRatio. pair, range : - 2 ... 2 ) { n in
137
140
update { $0. popOffsetRatio = . by( pair: n!) }
138
141
} ) ,
139
- . init( title: " Stack position " , kind: . doubleSlider( current: options. stackPosition. pair) { n in
142
+ . init( title: " Stack position " , kind: . doubleSlider( current: options. stackPosition. pair, range : - 1 ... 1 ) { n in
140
143
update { $0. stackPosition = . by( pair: n!) }
141
144
} ) ,
142
145
. init( title: " Reverse " , kind: . toggleSwitch( current: options. reverse) { n in
@@ -158,19 +161,19 @@ class LayoutDesignerViewModel {
158
161
self ? . update ( options: & options, closure: $0)
159
162
}
160
163
optionViewModels = [
161
- . init( title: " Piece size ratio " , kind: . doubleSlider( current: options. pieceSizeRatio. pair) { n in
164
+ . init( title: " Piece size ratio " , kind: . doubleSlider( current: options. pieceSizeRatio. pair, range : 0.01 ... 1 ) { n in
162
165
update { $0. pieceSizeRatio = . by( pair: n!) }
163
166
} ) ,
164
167
. init( title: " Container scale ratio " , kind: . singleSlider( current: options. containerScaleRatio) { n in
165
168
update { $0. containerScaleRatio = n! }
166
169
} ) ,
167
- . init( title: " Container translation ratio " , kind: . doubleSlider( current: options. containerTranslationRatio. pair) { n in
170
+ . init( title: " Container translation ratio " , kind: . doubleSlider( current: options. containerTranslationRatio. pair, range : 0 ... 2 ) { n in
168
171
update { $0. containerTranslationRatio = . by( pair: n!) }
169
172
} ) ,
170
- . init( title: " Container min translation ratio " , kind: . doubleSlider( current: options. containerMinTranslationRatio? . pair, optional: true ) { n in
173
+ . init( title: " Container min translation ratio " , kind: . doubleSlider( current: options. containerMinTranslationRatio? . pair, range : 0 ... 2 , optional: true ) { n in
171
174
update { $0. containerMinTranslationRatio = n. map { . by( pair: $0) } }
172
175
} ) ,
173
- . init( title: " Container max translation ratio " , kind: . doubleSlider( current: options. containerMaxTranslationRatio? . pair, optional: true ) { n in
176
+ . init( title: " Container max translation ratio " , kind: . doubleSlider( current: options. containerMaxTranslationRatio? . pair, range : 0 ... 2 , optional: true ) { n in
174
177
update { $0. containerMaxTranslationRatio = n. map { . by( pair: $0) } }
175
178
} )
176
179
]
0 commit comments