Skip to content

Commit

Permalink
#43 factor out Y_EQUALS_STRING constant
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Malley <[email protected]>
  • Loading branch information
pixelzoom committed Nov 6, 2018
1 parent 4061eb6 commit 43f65bf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions js/common/view/GQEquationFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ define( require => {
const RichText = require( 'SCENERY/nodes/RichText' );
const Util = require( 'DOT/Util' );

// constants
const Y_EQUALS_STRING = GQSymbols.y + ' ' + MathSymbols.EQUAL_TO; // 'y ='

const GQEquationFactory = {

/**
Expand All @@ -44,9 +47,8 @@ define( require => {
const b = Util.toFixedNumber( quadratic.b, options.bDecimals );
const c = Util.toFixedNumber( quadratic.c, options.cDecimals );

//REVIEW: Looks like this same string is built on line 142, should it be a constant for this file?
// y =
let equationString = GQSymbols.y + ' ' + MathSymbols.EQUAL_TO + ' ';
let equationString = Y_EQUALS_STRING + ' ';

if ( a === 0 && b === 0 && c === 0 ) {

Expand Down Expand Up @@ -139,7 +141,7 @@ define( require => {
const k = Util.toFixedNumber( quadratic.k, options.kDecimals );

// y =
let equationString = GQSymbols.y + ' ' + MathSymbols.EQUAL_TO + ' ';
let equationString = Y_EQUALS_STRING + ' ';

if ( a === 0 && k === 0 ) {

Expand Down Expand Up @@ -203,8 +205,7 @@ define( require => {
createDirectrix( directrix ) {

// y = N
const equationString = GQSymbols.y + ' ' + MathSymbols.EQUAL_TO + ' ' +
Util.toFixedNumber( directrix, GQConstants.DIRECTRIX_DECIMALS );
const equationString = Y_EQUALS_STRING + ' ' + Util.toFixedNumber( directrix, GQConstants.DIRECTRIX_DECIMALS );

const equationNode = new RichText( equationString, {
font: new PhetFont( GQConstants.GRAPH_EQUATION_FONT_SIZE ),
Expand Down

0 comments on commit 43f65bf

Please sign in to comment.