RingGeometry
pixi-wheels / index / RingGeometry
Class: RingGeometry
Defined in: core/RingGeometry.ts:25
The sections of one ring, laid out around the circle.
Pure data, no PixiJS. Section 0 begins at startAngle and sections
proceed clockwise (increasing angle); each arc is its weight’s share of
360. Weights can change at run time (setWeights) and the layout is
recomputed, which is all a dynamic section is.
Constructors#
Constructor#
new RingGeometry(configs: readonly WheelSectionConfig[], options?: RingGeometryOptions): RingGeometry;
Defined in: core/RingGeometry.ts:33
Parameters#
| Parameter | Type |
|---|---|
configs | readonly WheelSectionConfig[] |
options | RingGeometryOptions |
Returns#
RingGeometry
Properties#
| Property | Modifier | Type | Defined in |
|---|---|---|---|
startAngle | readonly | number | core/RingGeometry.ts:26 |
Accessors#
count#
Get Signature#
get count(): number;
Defined in: core/RingGeometry.ts:61
Returns
number
sections#
Get Signature#
get sections(): readonly ResolvedSection[];
Defined in: core/RingGeometry.ts:57
Sections in layout order, with current geometry.
Returns
readonly ResolvedSection[]
Methods#
boundaries()#
boundaries(): number[];
Defined in: core/RingGeometry.ts:135
Every divider angle (normalised), one per section start.
Returns#
number[]
byId()#
byId(id: string): ResolvedSection;
Defined in: core/RingGeometry.ts:88
Parameters#
| Parameter | Type |
|---|---|
id | string |
Returns#
byIndex()#
byIndex(index: number): ResolvedSection;
Defined in: core/RingGeometry.ts:98
Parameters#
| Parameter | Type |
|---|---|
index | number |
Returns#
byValue()#
byValue(value: string | number): ResolvedSection[];
Defined in: core/RingGeometry.ts:104
Parameters#
| Parameter | Type |
|---|---|
value | string | number |
Returns#
entryAngle()#
entryAngle(section: ResolvedSection, direction: SpinDirection): number;
Defined in: core/RingGeometry.ts:125
The boundary of a section that a pointer meets first when the ring
turns in direction. A clockwise-turning ring sweeps decreasing local
angles under a fixed pointer, so the pointer enters at the section’s end.
Parameters#
| Parameter | Type |
|---|---|
section | ResolvedSection |
direction | SpinDirection |
Returns#
number
exitAngle()#
exitAngle(section: ResolvedSection, direction: SpinDirection): number;
Defined in: core/RingGeometry.ts:130
The boundary a pointer leaves a section through.
Parameters#
| Parameter | Type |
|---|---|
section | ResolvedSection |
direction | SpinDirection |
Returns#
number
has()#
has(id: string): boolean;
Defined in: core/RingGeometry.ts:94
Parameters#
| Parameter | Type |
|---|---|
id | string |
Returns#
boolean
sectionAt()#
sectionAt(localAngle: number): ResolvedSection;
Defined in: core/RingGeometry.ts:109
The section that contains a wheel-local angle.
Parameters#
| Parameter | Type |
|---|---|
localAngle | number |
Returns#
setWeights()#
setWeights(next: Readonly<Record<string, number>>): void;
Defined in: core/RingGeometry.ts:75
Replace weights for the named sections and re-lay the ring out. Sections not named keep their weight. Throws on an unknown id or a non-positive weight; a zero-width section would be unlandable.
Parameters#
| Parameter | Type |
|---|---|
next | Readonly<Record<string, number>> |
Returns#
void
weights()#
weights(): Record<string, number>;
Defined in: core/RingGeometry.ts:66
Current weights by id.
Returns#
Record<string, number>