pixi-wheels

RingGeometry

pixi-wheels


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#

ParameterType
configsreadonly WheelSectionConfig[]
optionsRingGeometryOptions

Returns#

RingGeometry

Properties#

PropertyModifierTypeDefined in
startAnglereadonlynumbercore/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#

ParameterType
idstring

Returns#

ResolvedSection


byIndex()#

byIndex(index: number): ResolvedSection;

Defined in: core/RingGeometry.ts:98

Parameters#

ParameterType
indexnumber

Returns#

ResolvedSection


byValue()#

byValue(value: string | number): ResolvedSection[];

Defined in: core/RingGeometry.ts:104

Parameters#

ParameterType
valuestring | number

Returns#

ResolvedSection[]


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#

ParameterType
sectionResolvedSection
directionSpinDirection

Returns#

number


exitAngle()#

exitAngle(section: ResolvedSection, direction: SpinDirection): number;

Defined in: core/RingGeometry.ts:130

The boundary a pointer leaves a section through.

Parameters#

ParameterType
sectionResolvedSection
directionSpinDirection

Returns#

number


has()#

has(id: string): boolean;

Defined in: core/RingGeometry.ts:94

Parameters#

ParameterType
idstring

Returns#

boolean


sectionAt()#

sectionAt(localAngle: number): ResolvedSection;

Defined in: core/RingGeometry.ts:109

The section that contains a wheel-local angle.

Parameters#

ParameterType
localAnglenumber

Returns#

ResolvedSection


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#

ParameterType
nextReadonly<Record<string, number>>

Returns#

void


weights()#

weights(): Record<string, number>;

Defined in: core/RingGeometry.ts:66

Current weights by id.

Returns#

Record<string, number>