From 01e40100406e65ea9e79bb9a025e2e8637f30d31 Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 4 May 2021 15:26:33 -0800 Subject: [PATCH] instrument inProportionProperty and movingInDirectionProperty, https://github.com/phetsims/ratio-and-proportion/issues/351 https://github.com/phetsims/ratio-and-proportion/issues/142 --- js/common/model/RAPModel.js | 6 +++++- js/common/model/RAPRatio.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/common/model/RAPModel.js b/js/common/model/RAPModel.js index 0579e292..eae6df89 100644 --- a/js/common/model/RAPModel.js +++ b/js/common/model/RAPModel.js @@ -13,6 +13,7 @@ import DerivedProperty from '../../../../axon/js/DerivedProperty.js'; import NumberProperty from '../../../../axon/js/NumberProperty.js'; import Utils from '../../../../dot/js/Utils.js'; import Vector2 from '../../../../dot/js/Vector2.js'; +import BooleanIO from '../../../../tandem/js/types/BooleanIO.js'; import NumberIO from '../../../../tandem/js/types/NumberIO.js'; import ratioAndProportion from '../../ratioAndProportion.js'; import rapConstants from '../rapConstants.js'; @@ -114,7 +115,10 @@ unclampedFitness: ${unclampedFitness} this.inProportionProperty = new DerivedProperty( [ this.unclampedFitnessProperty, this.ratio.movingInDirectionProperty - ], this.inProportion.bind( this ) ); + ], this.inProportion.bind( this ), { + tandem: tandem.createTandem( 'inProportionProperty' ), + phetioType: DerivedProperty.DerivedPropertyIO( BooleanIO ) + } ); // This must be done here, because of the reentrant nature of how fitness changes when the ratio is locked this.targetRatioProperty.link( () => { diff --git a/js/common/model/RAPRatio.js b/js/common/model/RAPRatio.js index 86602567..3da45ca4 100644 --- a/js/common/model/RAPRatio.js +++ b/js/common/model/RAPRatio.js @@ -13,6 +13,7 @@ import NumberProperty from '../../../../axon/js/NumberProperty.js'; import Property from '../../../../axon/js/Property.js'; import Range from '../../../../dot/js/Range.js'; import Utils from '../../../../dot/js/Utils.js'; +import BooleanIO from '../../../../tandem/js/types/BooleanIO.js'; import ratioAndProportion from '../../ratioAndProportion.js'; import rapConstants from '../rapConstants.js'; import RAPRatioTuple from './RAPRatioTuple.js'; @@ -85,6 +86,9 @@ class RAPRatio { // Ignore the speed component when the ratio is locked return bothMoving && movingInSameDirection && ( movingFastEnough || ratioLocked ); + }, { + tandem: tandem.createTandem( 'movingInDirectionProperty' ), + phetioType: DerivedProperty.DerivedPropertyIO( BooleanIO ) } ); // @private - To avoid an infinite loop as setting the tupleProperty from inside its lock-ratio-support