Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
fix(core): adjust helpers to use NumberInput
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Apr 18, 2022
1 parent 6cfbae1 commit 109a8d0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
14 changes: 8 additions & 6 deletions libs/core/helpers/src/lib/arrow-helper/arrow-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
AnyConstructor,
NgtCommonHelper,
provideCommonHelperRef,
coerceNumberProperty,
NumberInput,
} from '@angular-three/core';
import {
ChangeDetectionStrategy,
Expand Down Expand Up @@ -35,16 +37,16 @@ export class NgtArrowHelper extends NgtCommonHelper<THREE.ArrowHelper> {
this.set({ origin });
}

@Input() set length(length: number) {
this.set({ length });
@Input() set length(length: NumberInput) {
this.set({ length: coerceNumberProperty(length) });
}

@Input() set headLength(headLength: number) {
this.set({ headLength });
@Input() set headLength(headLength: NumberInput) {
this.set({ headLength: coerceNumberProperty(headLength) });
}

@Input() set headWidth(headWidth: number) {
this.set({ headWidth });
@Input() set headWidth(headWidth: NumberInput) {
this.set({ headWidth: coerceNumberProperty(headWidth) });
}

override get helperType(): AnyConstructor<THREE.ArrowHelper> {
Expand Down
6 changes: 4 additions & 2 deletions libs/core/helpers/src/lib/axes-helper/axes-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
AnyConstructor,
NgtCommonHelper,
provideCommonHelperRef,
coerceNumberProperty,
NumberInput,
} from '@angular-three/core';
import {
ChangeDetectionStrategy,
Expand All @@ -27,8 +29,8 @@ export class NgtAxesHelper extends NgtCommonHelper<THREE.AxesHelper> {
this.instanceArgs = v;
}

@Input() set size(size: number) {
this.set({ size });
@Input() set size(size: NumberInput) {
this.set({ size: coerceNumberProperty(size) });
}

override get helperType(): AnyConstructor<THREE.AxesHelper> {
Expand Down
10 changes: 6 additions & 4 deletions libs/core/helpers/src/lib/grid-helper/grid-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
AnyConstructor,
NgtCommonHelper,
provideCommonHelperRef,
coerceNumberProperty,
NumberInput,
} from '@angular-three/core';
import {
ChangeDetectionStrategy,
Expand All @@ -27,12 +29,12 @@ export class NgtGridHelper extends NgtCommonHelper<THREE.GridHelper> {
this.instanceArgs = v;
}

@Input() set size(size: number) {
this.set({ size });
@Input() set size(size: NumberInput) {
this.set({ size: coerceNumberProperty(size) });
}

@Input() set divisions(divisions: number) {
this.set({ divisions });
@Input() set divisions(divisions: NumberInput) {
this.set({ divisions: coerceNumberProperty(divisions) });
}

@Input() set color1(color1: THREE.ColorRepresentation) {
Expand Down
18 changes: 10 additions & 8 deletions libs/core/helpers/src/lib/polar-grid-helper/polar-grid-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
AnyConstructor,
NgtCommonHelper,
provideCommonHelperRef,
coerceNumberProperty,
NumberInput,
} from '@angular-three/core';
import {
ChangeDetectionStrategy,
Expand All @@ -27,20 +29,20 @@ export class NgtPolarGridHelper extends NgtCommonHelper<THREE.PolarGridHelper> {
this.instanceArgs = v;
}

@Input() set radius(radius: number) {
this.set({ radius });
@Input() set radius(radius: NumberInput) {
this.set({ radius: coerceNumberProperty(radius) });
}

@Input() set radials(radials: number) {
this.set({ radials });
@Input() set radials(radials: NumberInput) {
this.set({ radials: coerceNumberProperty(radials) });
}

@Input() set circles(circles: number) {
this.set({ circles });
@Input() set circles(circles: NumberInput) {
this.set({ circles: coerceNumberProperty(circles) });
}

@Input() set divisions(divisions: number) {
this.set({ divisions });
@Input() set divisions(divisions: NumberInput) {
this.set({ divisions: coerceNumberProperty(divisions) });
}

@Input() set color1(color1: THREE.ColorRepresentation) {
Expand Down

0 comments on commit 109a8d0

Please sign in to comment.