From aa22dce67bb0916654e197506a4c3ff42c83f004 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Thu, 1 Aug 2024 08:26:16 -0400 Subject: [PATCH] use DerivedStringProperty where appropriate, https://github.com/phetsims/balancing-chemical-equations/issues/155 --- js/game/view/GameFeedbackPanel.ts | 4 ++-- js/game/view/LevelSelectionNode.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/game/view/GameFeedbackPanel.ts b/js/game/view/GameFeedbackPanel.ts index 9b6f4d32..d9efc363 100644 --- a/js/game/view/GameFeedbackPanel.ts +++ b/js/game/view/GameFeedbackPanel.ts @@ -11,7 +11,6 @@ */ import Property from '../../../../axon/js/Property.js'; -import DerivedProperty from '../../../../axon/js/DerivedProperty.js'; import StringUtils from '../../../../phetcommon/js/util/StringUtils.js'; import FaceNode from '../../../../scenery-phet/js/FaceNode.js'; import PhetFont from '../../../../scenery-phet/js/PhetFont.js'; @@ -32,6 +31,7 @@ import optionize from '../../../../phet-core/js/optionize.js'; import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js'; import Equation from '../../common/model/Equation.js'; import Disposable from '../../../../axon/js/Disposable.js'; +import DerivedStringProperty from '../../../../axon/js/DerivedStringProperty.js'; // constants const TEXT_FONT = new PhetFont( 18 ); @@ -86,7 +86,7 @@ export default class GameFeedbackPanel extends Node { const faceNode = new FaceNode( 75 ); if ( !equation.balancedProperty.value ) { faceNode.frown(); } - const pointsAwardedStringProperty = new DerivedProperty( + const pointsAwardedStringProperty = new DerivedStringProperty( [ BalancingChemicalEquationsStrings.pattern_0pointsStringProperty ], pattern => StringUtils.format( pattern, points ) ); diff --git a/js/game/view/LevelSelectionNode.ts b/js/game/view/LevelSelectionNode.ts index 95bbc7f0..d13cf034 100644 --- a/js/game/view/LevelSelectionNode.ts +++ b/js/game/view/LevelSelectionNode.ts @@ -6,7 +6,6 @@ * @author Vasily Shakhov (mlearner.com) */ -import DerivedProperty from '../../../../axon/js/DerivedProperty.js'; import Bounds2 from '../../../../dot/js/Bounds2.js'; import { AtomNodeOptions } from '../../../../nitroglycerin/js/nodes/AtomNode.js'; import { combineOptions } from '../../../../phet-core/js/optionize.js'; @@ -25,6 +24,7 @@ import Molecule from '../../common/model/Molecule.js'; import GameModel from '../model/GameModel.js'; import GameViewProperties from './GameViewProperties.js'; import BCEQueryParameters from '../../common/BCEQueryParameters.js'; +import DerivedStringProperty from '../../../../axon/js/DerivedStringProperty.js'; // Molecules that appear on level-selection buttons, ordered by level number const levelMolecules = [ Molecule.HCl, Molecule.H2O, Molecule.NH3 ]; @@ -116,7 +116,7 @@ export default class LevelSelectionNode extends Node { */ function createLevelSelectionButtonIcon( level: number, moleculeAlignGroup: AlignGroup ): Node { - const labelStringProperty = new DerivedProperty( + const labelStringProperty = new DerivedStringProperty( [ BalancingChemicalEquationsStrings.pattern_0levelStringProperty ], pattern => StringUtils.format( pattern, level + 1 ) );