com.wallstop-studios.unity-helpers 2.0.0-rc73.2 → 2.0.0-rc73.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Runtime/Tags/AttributeEffect.cs +1 -0
- package/Styles/Elements/Progress/ArcedProgressBar.cs +345 -0
- package/Styles/Elements/Progress/ArcedProgressBar.cs.meta +3 -0
- package/Styles/Elements/{CircularProgressBar.cs → Progress/CircularProgressBar.cs} +56 -55
- package/Styles/Elements/Progress/GlitchProgressBar.cs +416 -0
- package/Styles/Elements/Progress/GlitchProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/LiquidProgressBar.cs +632 -0
- package/Styles/Elements/Progress/LiquidProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/MarchingAntsProgressBar.cs +722 -0
- package/Styles/Elements/Progress/MarchingAntsProgressBar.cs.meta +3 -0
- package/Styles/Elements/{RegularProgressBar.cs → Progress/RegularProgressBar.cs} +24 -13
- package/Styles/Elements/Progress/WigglyProgressBar.cs +837 -0
- package/Styles/Elements/Progress/WigglyProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress.meta +3 -0
- package/Styles/USS/ArcedProgressBar.uss +19 -0
- package/Styles/USS/ArcedProgressBar.uss.meta +3 -0
- package/Styles/USS/WigglyProgressBar.uss +17 -0
- package/Styles/USS/WigglyProgressBar.uss.meta +3 -0
- package/package.json +2 -1
- package/Styles/UXML/CircularProgressBar.uxml +0 -11
- package/Styles/UXML/CircularProgressBar.uxml.meta +0 -10
- package/Styles/UXML/RegularProgressBar.uxml +0 -22
- package/Styles/UXML/RegularProgressBar.uxml.meta +0 -10
- package/Styles/UXML.meta +0 -3
- /package/Styles/Elements/{CircularProgressBar.cs.meta → Progress/CircularProgressBar.cs.meta} +0 -0
- /package/Styles/Elements/{RegularProgressBar.cs.meta → Progress/RegularProgressBar.cs.meta} +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Styles.Elements.Progress
|
|
2
|
+
{
|
|
3
|
+
using System.ComponentModel;
|
|
4
|
+
using Core.Helper;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using UnityEngine.UIElements;
|
|
7
|
+
|
|
8
|
+
public sealed class ArcedProgressBar : VisualElement
|
|
9
|
+
{
|
|
10
|
+
public enum FillDirection
|
|
11
|
+
{
|
|
12
|
+
Forward = 0,
|
|
13
|
+
Reverse = 1,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public const string USSClassName = "arced-progress-bar";
|
|
17
|
+
public const string USSTrackColorVarName = "--arc-track-color";
|
|
18
|
+
public const string USSProgressColorVarName = "--arc-progress-color";
|
|
19
|
+
public const string USSThicknessVarName = "--arc-thickness";
|
|
20
|
+
|
|
21
|
+
private float _progress = 0.5f;
|
|
22
|
+
|
|
23
|
+
public float Progress
|
|
24
|
+
{
|
|
25
|
+
get => _progress;
|
|
26
|
+
set
|
|
27
|
+
{
|
|
28
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
29
|
+
{
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
_progress = Mathf.Clamp01(value);
|
|
33
|
+
MarkDirtyRepaint();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private float _radius = 50f;
|
|
38
|
+
|
|
39
|
+
public float Radius
|
|
40
|
+
{
|
|
41
|
+
get => _radius;
|
|
42
|
+
set
|
|
43
|
+
{
|
|
44
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
45
|
+
{
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
_radius = Mathf.Max(1f, value);
|
|
49
|
+
UpdateSize();
|
|
50
|
+
MarkDirtyRepaint();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private float _thickness = 10f;
|
|
55
|
+
|
|
56
|
+
public float Thickness
|
|
57
|
+
{
|
|
58
|
+
get => _thickness;
|
|
59
|
+
set
|
|
60
|
+
{
|
|
61
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
62
|
+
{
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
_thickness = Mathf.Max(1f, value);
|
|
66
|
+
UpdateSize();
|
|
67
|
+
MarkDirtyRepaint();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private float _startAngleDegrees = -90f;
|
|
72
|
+
|
|
73
|
+
public float StartAngleDegrees
|
|
74
|
+
{
|
|
75
|
+
get => _startAngleDegrees;
|
|
76
|
+
set
|
|
77
|
+
{
|
|
78
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
79
|
+
{
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
_startAngleDegrees = value;
|
|
83
|
+
MarkDirtyRepaint();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private float _endAngleDegrees = 90f;
|
|
88
|
+
|
|
89
|
+
public float EndAngleDegrees
|
|
90
|
+
{
|
|
91
|
+
get => _endAngleDegrees;
|
|
92
|
+
set
|
|
93
|
+
{
|
|
94
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
95
|
+
{
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
_endAngleDegrees = value;
|
|
99
|
+
MarkDirtyRepaint();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private FillDirection _fillDirection = FillDirection.Forward;
|
|
104
|
+
|
|
105
|
+
public FillDirection Direction
|
|
106
|
+
{
|
|
107
|
+
get => _fillDirection;
|
|
108
|
+
set
|
|
109
|
+
{
|
|
110
|
+
_fillDirection = value;
|
|
111
|
+
MarkDirtyRepaint();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private bool _roundedCaps = true;
|
|
116
|
+
|
|
117
|
+
public bool RoundedCaps
|
|
118
|
+
{
|
|
119
|
+
get => _roundedCaps;
|
|
120
|
+
set
|
|
121
|
+
{
|
|
122
|
+
_roundedCaps = value;
|
|
123
|
+
MarkDirtyRepaint();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private Color _trackColor = Color.gray;
|
|
128
|
+
|
|
129
|
+
public Color TrackColor
|
|
130
|
+
{
|
|
131
|
+
get => _trackColor;
|
|
132
|
+
set
|
|
133
|
+
{
|
|
134
|
+
_trackColor = value;
|
|
135
|
+
MarkDirtyRepaint();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private Color _progressColor = Color.cyan;
|
|
140
|
+
|
|
141
|
+
public Color ProgressColor
|
|
142
|
+
{
|
|
143
|
+
get => _progressColor;
|
|
144
|
+
set
|
|
145
|
+
{
|
|
146
|
+
_progressColor = value;
|
|
147
|
+
MarkDirtyRepaint();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public new class UxmlFactory : UxmlFactory<ArcedProgressBar, UxmlTraits> { }
|
|
152
|
+
|
|
153
|
+
public new class UxmlTraits : VisualElement.UxmlTraits
|
|
154
|
+
{
|
|
155
|
+
private readonly UxmlFloatAttributeDescription _progressAttribute = new()
|
|
156
|
+
{
|
|
157
|
+
name = "progress",
|
|
158
|
+
defaultValue = 0.5f,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
private readonly UxmlFloatAttributeDescription _radiusAttribute = new()
|
|
162
|
+
{
|
|
163
|
+
name = "radius",
|
|
164
|
+
defaultValue = 50f,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
private readonly UxmlFloatAttributeDescription _thicknessAttribute = new()
|
|
168
|
+
{
|
|
169
|
+
name = "thickness",
|
|
170
|
+
defaultValue = 10f,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
private readonly UxmlFloatAttributeDescription _startAngleAttribute = new()
|
|
174
|
+
{
|
|
175
|
+
name = "start-angle",
|
|
176
|
+
defaultValue = -90f,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
private readonly UxmlFloatAttributeDescription _endAngleAttribute = new()
|
|
180
|
+
{
|
|
181
|
+
name = "end-angle",
|
|
182
|
+
defaultValue = 90f,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
private readonly UxmlEnumAttributeDescription<FillDirection> _fillDirectionAttribute =
|
|
186
|
+
new() { name = "fill-direction", defaultValue = FillDirection.Forward };
|
|
187
|
+
|
|
188
|
+
private readonly UxmlBoolAttributeDescription _roundedCapsAttribute = new()
|
|
189
|
+
{
|
|
190
|
+
name = "rounded-caps",
|
|
191
|
+
defaultValue = true,
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
private readonly UxmlColorAttributeDescription _trackColorAttribute = new()
|
|
195
|
+
{
|
|
196
|
+
name = "track-color-attr",
|
|
197
|
+
defaultValue = Color.gray,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
private readonly UxmlColorAttributeDescription _progressColorAttribute = new()
|
|
201
|
+
{
|
|
202
|
+
name = "progress-color-attr",
|
|
203
|
+
defaultValue = Color.cyan,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
|
|
207
|
+
{
|
|
208
|
+
base.Init(ve, bag, cc);
|
|
209
|
+
if (ve is not ArcedProgressBar bar)
|
|
210
|
+
{
|
|
211
|
+
Debug.LogError(
|
|
212
|
+
$"Initialization failed, expected {nameof(ArcedProgressBar)}, found {ve?.GetType()}.)"
|
|
213
|
+
);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
bar.Progress = _progressAttribute.GetValueFromBag(bag, cc);
|
|
218
|
+
bar.Radius = _radiusAttribute.GetValueFromBag(bag, cc);
|
|
219
|
+
bar.Thickness = _thicknessAttribute.GetValueFromBag(bag, cc);
|
|
220
|
+
bar.StartAngleDegrees = _startAngleAttribute.GetValueFromBag(bag, cc);
|
|
221
|
+
bar.EndAngleDegrees = _endAngleAttribute.GetValueFromBag(bag, cc);
|
|
222
|
+
bar.Direction = _fillDirectionAttribute.GetValueFromBag(bag, cc);
|
|
223
|
+
bar.RoundedCaps = _roundedCapsAttribute.GetValueFromBag(bag, cc);
|
|
224
|
+
bar.TrackColor = _trackColorAttribute.GetValueFromBag(bag, cc);
|
|
225
|
+
bar.ProgressColor = _progressColorAttribute.GetValueFromBag(bag, cc);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
public ArcedProgressBar()
|
|
230
|
+
{
|
|
231
|
+
AddToClassList(USSClassName);
|
|
232
|
+
generateVisualContent += OnGenerateVisualContent;
|
|
233
|
+
RegisterCallback<CustomStyleResolvedEvent>(OnCustomStyleResolved);
|
|
234
|
+
UpdateSize();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private void UpdateSize()
|
|
238
|
+
{
|
|
239
|
+
float diameter = (_radius + _thickness / 2f) * 2f;
|
|
240
|
+
style.width = diameter;
|
|
241
|
+
style.height = diameter;
|
|
242
|
+
style.minWidth = diameter;
|
|
243
|
+
style.minHeight = diameter;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private void OnCustomStyleResolved(CustomStyleResolvedEvent evt)
|
|
247
|
+
{
|
|
248
|
+
if (
|
|
249
|
+
customStyle.TryGetValue(
|
|
250
|
+
new CustomStyleProperty<Color>(USSTrackColorVarName),
|
|
251
|
+
out Color trackCol
|
|
252
|
+
)
|
|
253
|
+
)
|
|
254
|
+
{
|
|
255
|
+
_trackColor = trackCol;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (
|
|
259
|
+
customStyle.TryGetValue(
|
|
260
|
+
new CustomStyleProperty<Color>(USSProgressColorVarName),
|
|
261
|
+
out Color progressCol
|
|
262
|
+
)
|
|
263
|
+
)
|
|
264
|
+
{
|
|
265
|
+
_progressColor = progressCol;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (
|
|
269
|
+
customStyle.TryGetValue(
|
|
270
|
+
new CustomStyleProperty<float>(USSThicknessVarName),
|
|
271
|
+
out float thickVal
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
{
|
|
275
|
+
_thickness = Mathf.Max(1f, thickVal);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
MarkDirtyRepaint();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private void OnGenerateVisualContent(MeshGenerationContext mgc)
|
|
282
|
+
{
|
|
283
|
+
if (_thickness <= 0)
|
|
284
|
+
{
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
Painter2D painter = mgc.painter2D;
|
|
289
|
+
Rect rect = contentRect;
|
|
290
|
+
Vector2 center = rect.center;
|
|
291
|
+
|
|
292
|
+
painter.lineWidth = _thickness;
|
|
293
|
+
painter.lineCap = _roundedCaps ? LineCap.Round : LineCap.Butt;
|
|
294
|
+
|
|
295
|
+
painter.strokeColor = _trackColor;
|
|
296
|
+
painter.BeginPath();
|
|
297
|
+
painter.Arc(center, _radius, _startAngleDegrees, _endAngleDegrees);
|
|
298
|
+
painter.Stroke();
|
|
299
|
+
|
|
300
|
+
if (Mathf.Approximately(_progress, 0f))
|
|
301
|
+
{
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
float startAngle;
|
|
306
|
+
ArcDirection direction;
|
|
307
|
+
float sweepAngleDegrees;
|
|
308
|
+
switch (_fillDirection)
|
|
309
|
+
{
|
|
310
|
+
case FillDirection.Forward:
|
|
311
|
+
{
|
|
312
|
+
startAngle = _startAngleDegrees;
|
|
313
|
+
direction = ArcDirection.Clockwise;
|
|
314
|
+
sweepAngleDegrees =
|
|
315
|
+
_progress * (_endAngleDegrees - _startAngleDegrees).PositiveMod(360f);
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
case FillDirection.Reverse:
|
|
319
|
+
{
|
|
320
|
+
startAngle = _endAngleDegrees;
|
|
321
|
+
direction = ArcDirection.CounterClockwise;
|
|
322
|
+
sweepAngleDegrees =
|
|
323
|
+
-1 * _progress * (_endAngleDegrees - _startAngleDegrees).PositiveMod(360f);
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
default:
|
|
327
|
+
{
|
|
328
|
+
throw new InvalidEnumArgumentException(
|
|
329
|
+
nameof(_fillDirection),
|
|
330
|
+
(int)_fillDirection,
|
|
331
|
+
typeof(FillDirection)
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (!Mathf.Approximately(sweepAngleDegrees, 0))
|
|
337
|
+
{
|
|
338
|
+
painter.strokeColor = _progressColor;
|
|
339
|
+
painter.BeginPath();
|
|
340
|
+
painter.Arc(center, _radius, startAngle, startAngle + sweepAngleDegrees, direction);
|
|
341
|
+
painter.Stroke();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
namespace WallstopStudios.UnityHelpers.Styles.Elements
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Styles.Elements.Progress
|
|
2
2
|
{
|
|
3
3
|
using System.ComponentModel;
|
|
4
4
|
using UnityEngine;
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
get => _progress;
|
|
32
32
|
set
|
|
33
33
|
{
|
|
34
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
35
|
+
{
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
34
38
|
_progress = Mathf.Clamp01(value);
|
|
35
39
|
MarkDirtyRepaint();
|
|
36
40
|
}
|
|
@@ -42,6 +46,10 @@
|
|
|
42
46
|
get => _radius;
|
|
43
47
|
set
|
|
44
48
|
{
|
|
49
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
50
|
+
{
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
45
53
|
_radius = Mathf.Max(1f, value);
|
|
46
54
|
UpdateSize();
|
|
47
55
|
MarkDirtyRepaint();
|
|
@@ -54,19 +62,27 @@
|
|
|
54
62
|
get => _thickness;
|
|
55
63
|
set
|
|
56
64
|
{
|
|
65
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
66
|
+
{
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
57
69
|
_thickness = Mathf.Max(1f, value);
|
|
58
70
|
UpdateSize();
|
|
59
71
|
MarkDirtyRepaint();
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
74
|
|
|
63
|
-
private
|
|
64
|
-
public
|
|
75
|
+
private float _startPoint = GetStartAngleInDegrees(StartPointLocation.Top);
|
|
76
|
+
public float StartAt
|
|
65
77
|
{
|
|
66
78
|
get => _startPoint;
|
|
67
79
|
set
|
|
68
80
|
{
|
|
69
|
-
|
|
81
|
+
if (float.IsNaN(value) || float.IsInfinity(value))
|
|
82
|
+
{
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
_startPoint = value % 360f;
|
|
70
86
|
MarkDirtyRepaint();
|
|
71
87
|
}
|
|
72
88
|
}
|
|
@@ -126,8 +142,11 @@
|
|
|
126
142
|
defaultValue = 10f,
|
|
127
143
|
};
|
|
128
144
|
|
|
129
|
-
private readonly
|
|
130
|
-
|
|
145
|
+
private readonly UxmlFloatAttributeDescription _startPointAttribute = new()
|
|
146
|
+
{
|
|
147
|
+
name = "start-at",
|
|
148
|
+
defaultValue = GetStartAngleInDegrees(StartPointLocation.Top),
|
|
149
|
+
};
|
|
131
150
|
|
|
132
151
|
private readonly UxmlEnumAttributeDescription<FillDirection> _fillDirectionAttribute =
|
|
133
152
|
new() { name = "direction", defaultValue = FillDirection.Clockwise };
|
|
@@ -222,63 +241,33 @@
|
|
|
222
241
|
float drawRadius = _radius;
|
|
223
242
|
Vector2 center = rect.center;
|
|
224
243
|
|
|
225
|
-
|
|
244
|
+
painter.strokeColor = _trackColor;
|
|
245
|
+
painter.lineWidth = _thickness;
|
|
246
|
+
painter.BeginPath();
|
|
247
|
+
painter.Arc(center, drawRadius, 0f, 360f);
|
|
248
|
+
painter.Stroke();
|
|
249
|
+
|
|
250
|
+
if (Mathf.Approximately(_progress, 0))
|
|
226
251
|
{
|
|
227
|
-
painter.strokeColor = _trackColor;
|
|
228
|
-
painter.lineWidth = _thickness;
|
|
229
|
-
painter.BeginPath();
|
|
230
|
-
painter.Arc(center, drawRadius, 0f, 360f);
|
|
231
|
-
painter.Stroke();
|
|
232
252
|
return;
|
|
233
253
|
}
|
|
234
254
|
|
|
255
|
+
ArcDirection direction;
|
|
256
|
+
float sweepAngleDegrees;
|
|
257
|
+
|
|
235
258
|
switch (_fillDirection)
|
|
236
259
|
{
|
|
237
|
-
case FillDirection.
|
|
260
|
+
case FillDirection.Clockwise:
|
|
238
261
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
painter.Arc(center, drawRadius, 0f, 360f);
|
|
243
|
-
painter.Stroke();
|
|
244
|
-
|
|
245
|
-
float startAngleDegrees = GetStartAngleInDegrees(_startPoint);
|
|
246
|
-
float sweepAngleDegrees = -1 * _progress * 360f;
|
|
247
|
-
|
|
248
|
-
painter.strokeColor = _trackColor;
|
|
249
|
-
painter.lineWidth = _thickness;
|
|
250
|
-
painter.BeginPath();
|
|
251
|
-
painter.Arc(
|
|
252
|
-
center,
|
|
253
|
-
drawRadius,
|
|
254
|
-
startAngleDegrees,
|
|
255
|
-
(startAngleDegrees + sweepAngleDegrees)
|
|
256
|
-
);
|
|
257
|
-
painter.Stroke();
|
|
258
|
-
return;
|
|
262
|
+
direction = ArcDirection.Clockwise;
|
|
263
|
+
sweepAngleDegrees = _progress * 360f;
|
|
264
|
+
break;
|
|
259
265
|
}
|
|
260
|
-
case FillDirection.
|
|
266
|
+
case FillDirection.CounterClockwise:
|
|
261
267
|
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
painter.Arc(center, drawRadius, 0f, 360f);
|
|
266
|
-
painter.Stroke();
|
|
267
|
-
|
|
268
|
-
float startAngleDegrees = GetStartAngleInDegrees(_startPoint);
|
|
269
|
-
float sweepAngleDegrees = _progress * 360f;
|
|
270
|
-
|
|
271
|
-
painter.strokeColor = _progressColor;
|
|
272
|
-
painter.lineWidth = _thickness;
|
|
273
|
-
painter.BeginPath();
|
|
274
|
-
painter.Arc(
|
|
275
|
-
center,
|
|
276
|
-
drawRadius,
|
|
277
|
-
startAngleDegrees,
|
|
278
|
-
(startAngleDegrees + sweepAngleDegrees)
|
|
279
|
-
);
|
|
280
|
-
painter.Stroke();
|
|
281
|
-
return;
|
|
268
|
+
direction = ArcDirection.CounterClockwise;
|
|
269
|
+
sweepAngleDegrees = -1 * _progress * 360f;
|
|
270
|
+
break;
|
|
282
271
|
}
|
|
283
272
|
default:
|
|
284
273
|
{
|
|
@@ -289,9 +278,21 @@
|
|
|
289
278
|
);
|
|
290
279
|
}
|
|
291
280
|
}
|
|
281
|
+
|
|
282
|
+
painter.strokeColor = _progressColor;
|
|
283
|
+
painter.lineWidth = _thickness;
|
|
284
|
+
painter.BeginPath();
|
|
285
|
+
painter.Arc(
|
|
286
|
+
center,
|
|
287
|
+
drawRadius,
|
|
288
|
+
_startPoint,
|
|
289
|
+
_startPoint + sweepAngleDegrees,
|
|
290
|
+
direction
|
|
291
|
+
);
|
|
292
|
+
painter.Stroke();
|
|
292
293
|
}
|
|
293
294
|
|
|
294
|
-
|
|
295
|
+
public static float GetStartAngleInDegrees(StartPointLocation location)
|
|
295
296
|
{
|
|
296
297
|
return location switch
|
|
297
298
|
{
|