From 6e4ff3756c78d1c4ce2e44143d51c5b6e2d255d5 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 22 Feb 2022 17:23:26 -0700 Subject: [PATCH] factor out GOSim.ts, https://github.com/phetsims/geometric-optics-basics/issues/2 --- js/geometric-optics-basics-main.ts | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/js/geometric-optics-basics-main.ts b/js/geometric-optics-basics-main.ts index 0335f7a..d0c0f15 100644 --- a/js/geometric-optics-basics-main.ts +++ b/js/geometric-optics-basics-main.ts @@ -6,44 +6,26 @@ * @author Chris Malley (PixelZoom, Inc.) */ -import GOConstants from '../../geometric-optics/js/common/GOConstants.js'; import GOGlobalOptions from '../../geometric-optics/js/common/GOGlobalOptions.js'; import GOQueryParameters from '../../geometric-optics/js/common/GOQueryParameters.js'; -import LensScreen from '../../geometric-optics/js/lens/LensScreen.js'; -import MirrorScreen from '../../geometric-optics/js/mirror/MirrorScreen.js'; -import Sim from '../../joist/js/Sim.js'; +import GOSim from '../../geometric-optics/js/GOSim.js'; import simLauncher from '../../joist/js/simLauncher.js'; -import Tandem from '../../tandem/js/Tandem.js'; import geometricOpticsBasicsStrings from './geometricOpticsBasicsStrings.js'; // If enable2F query parameter was not in the URL, change the default. +// This must be done in geometric-optics-basics-main.ts so that it only affects that sim. if ( !QueryStringMachine.containsKey( 'enable2F' ) ) { GOQueryParameters.enable2F = true; } -const simOptions = { - - credits: GOConstants.CREDITS, - - // pdom options - hasKeyboardHelpContent: true -}; - simLauncher.launch( () => { // ?focalLengthControl is ignored, and the 'direct' focal-length model is used. // This must be done inside the callback to simLauncher.launch. GOGlobalOptions.focalLengthControlTypeProperty.value = 'direct'; - const sim = new Sim( geometricOpticsBasicsStrings[ 'geometric-optics-basics' ].title, [ - new LensScreen( { - isBasicsVersion: true, - tandem: Tandem.ROOT.createTandem( 'lensScreen' ) - } ), - new MirrorScreen( { - isBasicsVersion: true, - tandem: Tandem.ROOT.createTandem( 'mirrorScreen' ) - } ) - ], simOptions ); + const sim = new GOSim( geometricOpticsBasicsStrings[ 'geometric-optics-basics' ].title, { + isBasicsVersion: true + } ); sim.start(); } ); \ No newline at end of file