From 6eaf3cc438d0edfebdee4148ea92523c8afeaf2d Mon Sep 17 00:00:00 2001 From: Jonathan Olson Date: Wed, 26 Dec 2018 19:22:45 -0700 Subject: [PATCH] Adding screen icons and converting to ES6, see https://github.com/phetsims/fractions-common/issues/40 and https://github.com/phetsims/fractions-common/issues/30 --- js/fractions-equality-main.js | 25 +++++++++--------- js/fractionsEquality.js | 4 +-- js/view/EqualityLabScreen.js | 50 +++++++++++++++-------------------- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/js/fractions-equality-main.js b/js/fractions-equality-main.js index 8607675..c348f62 100644 --- a/js/fractions-equality-main.js +++ b/js/fractions-equality-main.js @@ -5,24 +5,24 @@ * * @author Jonathan Olson */ -define( function( require ) { +define( require => { 'use strict'; // modules - var EqualityLabScreen = require( 'FRACTIONS_EQUALITY/view/EqualityLabScreen' ); - var FractionsScreen = require( 'FRACTION_MATCHER/view/FractionsScreen' ); - var Sim = require( 'JOIST/Sim' ); - var SimLauncher = require( 'JOIST/SimLauncher' ); - var Tandem = require( 'TANDEM/Tandem' ); + const EqualityLabScreen = require( 'FRACTIONS_EQUALITY/view/EqualityLabScreen' ); + const FractionsScreen = require( 'FRACTION_MATCHER/view/FractionsScreen' ); + const Sim = require( 'JOIST/Sim' ); + const SimLauncher = require( 'JOIST/SimLauncher' ); + const Tandem = require( 'TANDEM/Tandem' ); // strings - var fractionsEqualityTitleString = require( 'string!FRACTIONS_EQUALITY/fractions-equality.title' ); - var screenGameString = require( 'string!FRACTIONS_EQUALITY/screen.game' ); + const fractionsEqualityTitleString = require( 'string!FRACTIONS_EQUALITY/fractions-equality.title' ); + const screenGameString = require( 'string!FRACTIONS_EQUALITY/screen.game' ); // constants - var tandem = Tandem.rootTandem; + const tandem = Tandem.rootTandem; - var simOptions = { + const simOptions = { credits: { //TODO fill in proper credits, all of these fields are optional, see joist.AboutDialog leadDesign: '', @@ -34,11 +34,10 @@ define( function( require ) { } }; - SimLauncher.launch( function() { - var sim = new Sim( fractionsEqualityTitleString, [ + SimLauncher.launch( () => { + const sim = new Sim( fractionsEqualityTitleString, [ new EqualityLabScreen(), new FractionsScreen( tandem.createTandem( 'fractionsScreen' ), { - // TODO: don't hack like this name: screenGameString } ) ], simOptions ); diff --git a/js/fractionsEquality.js b/js/fractionsEquality.js index 840a7cf..d3d5958 100644 --- a/js/fractionsEquality.js +++ b/js/fractionsEquality.js @@ -5,11 +5,11 @@ * * @author Jonathan Olson */ -define( function( require ) { +define( require => { 'use strict'; // modules - var Namespace = require( 'PHET_CORE/Namespace' ); + const Namespace = require( 'PHET_CORE/Namespace' ); return new Namespace( 'fractionsEquality' ); } ); \ No newline at end of file diff --git a/js/view/EqualityLabScreen.js b/js/view/EqualityLabScreen.js index aee7543..9440b6a 100644 --- a/js/view/EqualityLabScreen.js +++ b/js/view/EqualityLabScreen.js @@ -1,42 +1,36 @@ // Copyright 2018, University of Colorado Boulder /** - * TODO: doc + * Equality Lab screen for Fractions: Equality * * @author Jonathan Olson */ -define( function( require ) { +define( require => { 'use strict'; // modules - var EqualityLabModel = require( 'FRACTIONS_COMMON/intro/model/EqualityLabModel' ); - var EqualityLabScreenView = require( 'FRACTIONS_COMMON/intro/view/EqualityLabScreenView' ); - var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' ); - var fractionsEquality = require( 'FRACTIONS_EQUALITY/fractionsEquality' ); - var inherit = require( 'PHET_CORE/inherit' ); - var Screen = require( 'JOIST/Screen' ); + const EqualityLabModel = require( 'FRACTIONS_COMMON/intro/model/EqualityLabModel' ); + const EqualityLabScreenView = require( 'FRACTIONS_COMMON/intro/view/EqualityLabScreenView' ); + const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' ); + const fractionsEquality = require( 'FRACTIONS_EQUALITY/fractionsEquality' ); + const Screen = require( 'JOIST/Screen' ); // strings - var screenEqualityLabString = require( 'string!FRACTIONS_EQUALITY/screen.equalityLab' ); - - /** - * @constructor - */ - function EqualityLabScreen() { - - var options = { - name: screenEqualityLabString, - backgroundColorProperty: FractionsCommonColorProfile.introScreenBackgroundProperty - }; - - Screen.call( this, - function() { return new EqualityLabModel(); }, - function( model ) { return new EqualityLabScreenView( model ); }, - options - ); + const screenEqualityLabString = require( 'string!FRACTIONS_EQUALITY/screen.equalityLab' ); + + class EqualityLabScreen extends Screen { + constructor() { + super( + () => new EqualityLabModel(), + model => new EqualityLabScreenView( model ), + { + name: screenEqualityLabString, + backgroundColorProperty: FractionsCommonColorProfile.introScreenBackgroundProperty, + homeScreenIcon: EqualityLabScreenView.createScreenIcon() + } + ); + } } - fractionsEquality.register( 'EqualityLabScreen', EqualityLabScreen ); - - return inherit( Screen, EqualityLabScreen ); + return fractionsEquality.register( 'EqualityLabScreen', EqualityLabScreen ); } );