From 54621eecf1002c75418c2f12a52644ba4ac7c705 Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Wed, 6 Mar 2024 07:29:57 -0700 Subject: [PATCH] Change DynamicProperty declarations to less restrictive types, see https://github.com/phetsims/projectile-data-lab/issues/222 --- js/common-vsm/model/VSMModel.ts | 26 ++++++++++++++++-------- js/common-vsm/view/CustomLauncherNode.ts | 4 ++-- js/common/view/LauncherNode.ts | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/js/common-vsm/model/VSMModel.ts b/js/common-vsm/model/VSMModel.ts index 30373ff2..79ad92b7 100644 --- a/js/common-vsm/model/VSMModel.ts +++ b/js/common-vsm/model/VSMModel.ts @@ -31,6 +31,8 @@ import stopwatchTick_mp3 from '../../../sounds/stopwatchTick_mp3.js'; import soundManager from '../../../../tambo/js/soundManager.js'; import PDLQueryParameters from '../../common/PDLQueryParameters.js'; import PDLPreferences from '../../common/PDLPreferences.js'; +import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js'; +import PhetioProperty from '../../../../axon/js/PhetioProperty.js'; const tickSound = new SoundClip( stopwatchTick_mp3, { initialOutputLevel: 1 } ); soundManager.addSoundGenerator( tickSound ); @@ -56,19 +58,25 @@ export default class VSMModel extends PDLModel { public readonly measuringTapeBasePositionProperty; public readonly measuringTapeTipPositionProperty; - public readonly latestLaunchAngleProperty: DynamicProperty; - public readonly latestLaunchSpeedProperty: DynamicProperty; + //////////////////////////////////////////////////////////////////////////////////////// + // These DynamicProperties select based on the selected VSMField + + public readonly latestLaunchAngleProperty: TReadOnlyProperty; + public readonly latestLaunchSpeedProperty: TReadOnlyProperty; // The angleStabilizerProperty represents the amount of angle stabilization applied to the launcher. The value is between 0 and 1, where 0 means minimum stabilization and 1 means maximum stabilization. - public readonly angleStabilizerProperty: DynamicProperty; - public readonly standardDeviationAngleProperty: DynamicProperty; + public readonly angleStabilizerProperty: PhetioProperty; + public readonly standardDeviationAngleProperty: TReadOnlyProperty; + + public readonly selectedProjectileNumberProperty: PhetioProperty; + public readonly selectedProjectileProperty: TReadOnlyProperty; + public readonly numberOfLandedProjectilesProperty: TReadOnlyProperty; + public readonly totalProjectileCountProperty: TReadOnlyProperty; - public readonly selectedProjectileNumberProperty: DynamicProperty; - public readonly selectedProjectileProperty: DynamicProperty; - public readonly numberOfLandedProjectilesProperty: DynamicProperty; - public readonly totalProjectileCountProperty: DynamicProperty; + public readonly launcherProperty: PhetioProperty; - public readonly launcherProperty: DynamicProperty; + // End of DynamicProperties + //////////////////////////////////////////////////////////////////////////////////////// //REVIEW constructor should be protected public constructor( fields: T[], providedOptions: VSMModelOptions ) { diff --git a/js/common-vsm/view/CustomLauncherNode.ts b/js/common-vsm/view/CustomLauncherNode.ts index 4fe892b6..5740f3fa 100644 --- a/js/common-vsm/view/CustomLauncherNode.ts +++ b/js/common-vsm/view/CustomLauncherNode.ts @@ -54,8 +54,8 @@ export default class CustomLauncherNode extends LauncherNode { mysteryOrCustomProperty: TProperty, mysteryLauncherProperty: TProperty, launcherMechanismProperty: TProperty, - standardDeviationAngleProperty: TProperty, - latestLaunchSpeedProperty: TProperty, + standardDeviationAngleProperty: TReadOnlyProperty, + latestLaunchSpeedProperty: TReadOnlyProperty, fieldProperty: TReadOnlyProperty | null, providedOptions?: CustomLauncherNodeOptions ) { diff --git a/js/common/view/LauncherNode.ts b/js/common/view/LauncherNode.ts index 5bda3d87..cee3d45d 100644 --- a/js/common/view/LauncherNode.ts +++ b/js/common/view/LauncherNode.ts @@ -77,7 +77,7 @@ export default class LauncherNode extends Node { public constructor( private readonly modelViewTransform: ModelViewTransform2, private readonly meanLaunchAngleProperty: TProperty, launcherHeightProperty: TProperty, - mysteryLauncher: TProperty, + mysteryLauncher: TReadOnlyProperty, fieldProperty: TReadOnlyProperty | null, providedOptions?: LauncherNodeOptions ) {