From 06a654c6318ec960e2ea257cfc33678aae8698be Mon Sep 17 00:00:00 2001 From: jbphet Date: Tue, 29 Nov 2016 13:20:15 -0700 Subject: [PATCH] migrated Text nodes to TandemText, see #76 --- js/gravity-force-lab/view/MassControl.js | 12 +++++++++--- js/gravity-force-lab/view/MassNode.js | 18 +++++++++++------- .../view/ParameterControlPanel.js | 15 ++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/js/gravity-force-lab/view/MassControl.js b/js/gravity-force-lab/view/MassControl.js index 81232430..3ce8c775 100644 --- a/js/gravity-force-lab/view/MassControl.js +++ b/js/gravity-force-lab/view/MassControl.js @@ -15,7 +15,7 @@ define( function( require ) { var inherit = require( 'PHET_CORE/inherit' ); var Panel = require( 'SUN/Panel' ); var PhetFont = require( 'SCENERY_PHET/PhetFont' ); - var Text = require( 'SCENERY/nodes/Text' ); + var TandemText = require( 'TANDEM/scenery/nodes/TandemText' ); var NumberControl = require( 'SCENERY_PHET/NumberControl' ); var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); @@ -47,10 +47,16 @@ define( function( require ) { valuePattern: StringUtils.format( pattern0Value1UnitsString, '{0}', unitsKgString ), majorTicks: [ { value: massRange.min, - label: new Text( massRange.min, tickLabelOptions ) + label: new TandemText( + massRange.min, + _.extend( { tandem: tandem.createTandem( 'majorTickMinLabel' ) }, tickLabelOptions ) + ) }, { value: massRange.max, - label: new Text( massRange.max, tickLabelOptions ) + label: new TandemText( + massRange.max, + _.extend( { tandem: tandem.createTandem( 'majorTickMaxLabel' ) }, tickLabelOptions ) + ) } ], layoutFunction: NumberControl.createLayoutFunction3( { xSpacing: 10 } ), thumbFillEnabled: thumbColor.colorUtilsBrighter( 0.15 ), diff --git a/js/gravity-force-lab/view/MassNode.js b/js/gravity-force-lab/view/MassNode.js index f3877099..4232cb8b 100644 --- a/js/gravity-force-lab/view/MassNode.js +++ b/js/gravity-force-lab/view/MassNode.js @@ -26,7 +26,7 @@ define( function( require ) { var TandemDragHandler = require( 'TANDEM/scenery/input/TandemDragHandler' ); var TandemPath = require( 'TANDEM/scenery/nodes/TandemPath' ); var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); - var Text = require( 'SCENERY/nodes/Text' ); + var TandemText = require( 'TANDEM/scenery/nodes/TandemText' ); var Util = require( 'DOT/Util' ); // strings @@ -82,21 +82,24 @@ define( function( require ) { dragNode.addChild( this.massCircle ); dragNode.addChild( new Circle( 2, { fill: '#000' } ) ); var labelFont = new PhetFont( 12 ); - dragNode.addChild( new Text( options.label, { + dragNode.addChild( new TandemText( options.label, { font: labelFont, fill: '#000', pickable: false, maxWidth: LABEL_MAX_WIDTH, centerX: 0, - top: 4 + top: 4, + tandem: tandem.createTandem( 'labelShadowNode' ) + } ) ); - dragNode.addChild( new Text( options.label, { + dragNode.addChild( new TandemText( options.label, { font: labelFont, fill: '#fff', pickable: false, maxWidth: LABEL_MAX_WIDTH, centerX: -0.5, - top: 3.5 + top: 3.5, + tandem: tandem.createTandem( 'labelNode' ) } ) ); this.addChild( dragNode ); @@ -109,11 +112,12 @@ define( function( require ) { stroke: null, tandem: tandem.createTandem( 'arrowNode' ) } ); - var arrowText = new Text( options.title ? options.title : '', { + var arrowText = new TandemText( options.title ? options.title : '', { font: new PhetFont( 16 ), fill: '#000', y: -options.forceArrowHeight - 20, - maxWidth: 300 // empirically determined through testing with long strings + maxWidth: 300, // empirically determined through testing with long strings + tandem: tandem.createTandem( 'arrowText' ) } ); var markerLineShape = new Shape(); markerLineShape.moveTo( 0, -4 ); diff --git a/js/gravity-force-lab/view/ParameterControlPanel.js b/js/gravity-force-lab/view/ParameterControlPanel.js index 185fe29f..d9a4850e 100644 --- a/js/gravity-force-lab/view/ParameterControlPanel.js +++ b/js/gravity-force-lab/view/ParameterControlPanel.js @@ -15,7 +15,7 @@ define( function( require ) { var TandemNode = require( 'TANDEM/scenery/nodes/TandemNode' ); var PhetFont = require( 'SCENERY_PHET/PhetFont' ); var Panel = require( 'SUN/Panel' ); - var Text = require( 'SCENERY/nodes/Text' ); + var TandemText = require( 'TANDEM/scenery/nodes/TandemText' ); // strings var constantRadiusString = require( 'string!GRAVITY_FORCE_LAB/constantRadius' ); @@ -42,16 +42,21 @@ define( function( require ) { }, options ); var content = new TandemNode( { tandem: tandem.createTandem( 'content' ) } ); - var showValueText = new Text( showValuesString, { font: new PhetFont( 16 ), maxWidth: MAX_CAPTION_WIDTH } ); + var showValuesText = new TandemText( showValuesString, { + font: new PhetFont( 16 ), + maxWidth: MAX_CAPTION_WIDTH, + tandem: tandem.createTandem( 'showValuesText' ) + } ); var showValueCheckBox = new CheckBox( - showValueText, + showValuesText, model.showValuesProperty, { cursor: 'pointer', tandem: tandem.createTandem( 'showValueCheckBox' ) } ); content.addChild( showValueCheckBox ); - var constantRadiusText = new Text( constantRadiusString, { + var constantRadiusText = new TandemText( constantRadiusString, { font: new PhetFont( 16 ), - maxWidth: MAX_CAPTION_WIDTH + maxWidth: MAX_CAPTION_WIDTH, + tandem: tandem.createTandem( 'constantRadiusText' ) } ); var constantRadiusCheckBox = new CheckBox(