From 1955c455cc5b7b13f8db5569d4fd4c986b877456 Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 11 Aug 2022 11:01:21 -0600 Subject: [PATCH] initialize at declaration when possible, https://github.com/phetsims/ratio-and-proportion/issues/404 --- js/common/view/RAPTickMarkLabelsNode.ts | 6 ++---- js/common/view/mediaPipeOptions.ts | 10 ++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/js/common/view/RAPTickMarkLabelsNode.ts b/js/common/view/RAPTickMarkLabelsNode.ts index 63795f0d..1ca36a3e 100644 --- a/js/common/view/RAPTickMarkLabelsNode.ts +++ b/js/common/view/RAPTickMarkLabelsNode.ts @@ -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; private tickMarkRangeProperty: Property; private colorProperty: TReadOnlyProperty; public constructor( tickMarkViewProperty: EnumerationProperty, tickMarkRangeProperty: Property, height: number, - colorProperty: TReadOnlyProperty, options?: StrictOmit ) { + colorProperty: TReadOnlyProperty, options?: StrictOmit ) { super(); this.totalHeight = height; - this.heightOfText = null; this.tickMarkViewProperty = tickMarkViewProperty; this.tickMarkRangeProperty = tickMarkRangeProperty; this.colorProperty = colorProperty; @@ -52,7 +51,6 @@ class RAPTickMarkLabelsNode extends Node { } public layout( height: number ): void { - this.totalHeight = height; this.update( this.tickMarkRangeProperty.value, this.tickMarkViewProperty.value ); } diff --git a/js/common/view/mediaPipeOptions.ts b/js/common/view/mediaPipeOptions.ts index d0ebee0a..31c5c1ff 100644 --- a/js/common/view/mediaPipeOptions.ts +++ b/js/common/view/mediaPipeOptions.ts @@ -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; - public yAxisFlippedProperty: Property; - - 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();