-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathconstants.js
More file actions
90 lines (84 loc) · 2.05 KB
/
Copy pathconstants.js
File metadata and controls
90 lines (84 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Adjustment when drawing arcs to ensure 0° is north (due to canvas drawing arcs from 90°).
*/
export const arcAdjust = -90;
export const baseCanvasSize = 500; // 500 seemed to be a good value for this.
/**
* The period in milliseconds that we record drag events.
* Used to calculate how fast the wheel should spin after the drag ends.
* For example, if the wheel was dragged 20 degrees over the last 250ms,
* then it should continue rotating at a speed of 20 degrees every 250ms after the drag ends.
*/
export const dragCapturePeriod = 250;
/**
* Wheel vertical alignment enum.
*/
export const AlignWheel = Object.freeze({
top: 'top',
center: 'center',
bottom: 'bottom',
});
/**
* Text alignment enum.
*/
export const AlignText = Object.freeze({
left: 'left',
right: 'right',
center: 'center',
});
/**
* Wheel property defaults.
*/
export const Defaults = Object.freeze({
wheel: {
align: AlignWheel.center,
borderColor: '#000',
borderWidth: 1,
debug: false,
image: null,
isInteractive: true,
itemBackgroundColors: ['#fff'],
itemLabelAlign: AlignText.right,
itemLabelBaselineOffset: 0,
itemLabelColors: ['#000'],
itemLabelFont: 'sans-serif',
itemLabelFontSizeMax: baseCanvasSize,
itemLabelRadius: 0.85,
itemLabelRadiusMax: 0.2,
itemLabelRotation: 0,
itemLabelStrokeColor: '#fff',
itemLabelStrokeWidth: 0,
items: [],
lineColor: '#000',
lineWidth: 1,
pixelRatio: 0,
radius: 0.95,
rotation: 0,
rotationResistance: -35,
rotationSpeedMax: 300,
offset: {x: 0, y: 0},
onCurrentIndexChange: null,
onRest: null,
onSpin: null,
overlayImage: null,
pointerAngle: 0,
},
item: {
backgroundColor: null,
image: null,
imageOpacity: 1,
imageRadius: 0.5,
imageRotation: 0,
imageScale: 1,
label: '',
labelColor: null,
value: null,
weight: 1,
},
});
export const Debugging = Object.freeze({
pointerLineColor: '#ff00ff',
labelBoundingBoxColor: '#ff00ff',
labelRadiusColor: '#00ff00',
dragPointHue: 300,
});