Skip to content

Commit

Permalink
initialize at declaration when possible, #404
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 11, 2022
1 parent 8998a89 commit 1955c45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 2 additions & 4 deletions js/common/view/RAPTickMarkLabelsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@ const LABEL_X = 0;
class RAPTickMarkLabelsNode extends Node {

private totalHeight: number;
private heightOfText: number | null;
private heightOfText: number | null = null;
private tickMarkViewProperty: EnumerationProperty<TickMarkView>;
private tickMarkRangeProperty: Property<number>;
private colorProperty: TReadOnlyProperty<Color | string>;

public constructor( tickMarkViewProperty: EnumerationProperty<TickMarkView>, tickMarkRangeProperty: Property<number>, height: number,
colorProperty: TReadOnlyProperty<Color | string>, options?: StrictOmit<NodeOptions, 'children'> ) {
colorProperty: TReadOnlyProperty<Color | string>, options?: StrictOmit<NodeOptions, 'children'> ) {

super();

this.totalHeight = height;
this.heightOfText = null;
this.tickMarkViewProperty = tickMarkViewProperty;
this.tickMarkRangeProperty = tickMarkRangeProperty;
this.colorProperty = colorProperty;
Expand All @@ -52,7 +51,6 @@ class RAPTickMarkLabelsNode extends Node {
}

public layout( height: number ): void {

this.totalHeight = height;
this.update( this.tickMarkRangeProperty.value, this.tickMarkViewProperty.value );
}
Expand Down
10 changes: 2 additions & 8 deletions js/common/view/mediaPipeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
*/

import BooleanProperty from '../../../../axon/js/BooleanProperty.js';
import Property from '../../../../axon/js/Property.js';
import ratioAndProportion from '../../ratioAndProportion.js';

class MediaPipeOptions {
public xAxisFlippedProperty: Property<boolean>;
public yAxisFlippedProperty: Property<boolean>;

public constructor() {
this.xAxisFlippedProperty = new BooleanProperty( false );
this.yAxisFlippedProperty = new BooleanProperty( false );
}
public xAxisFlippedProperty = new BooleanProperty( false );
public yAxisFlippedProperty = new BooleanProperty( false );
}

const mediaPipeOptions = new MediaPipeOptions();
Expand Down

0 comments on commit 1955c45

Please sign in to comment.