Skip to content

Commit

Permalink
migrated Text nodes to TandemText, see #76
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 29, 2016
1 parent d9c1237 commit 06a654c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
12 changes: 9 additions & 3 deletions js/gravity-force-lab/view/MassControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -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 ),
Expand Down
18 changes: 11 additions & 7 deletions js/gravity-force-lab/view/MassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
15 changes: 10 additions & 5 deletions js/gravity-force-lab/view/ParameterControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand All @@ -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(
Expand Down

0 comments on commit 06a654c

Please sign in to comment.