Skip to content

Commit

Permalink
factor out GOSim.ts, #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 23, 2022
1 parent 9736c90 commit 6e4ff37
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions js/geometric-optics-basics-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
} );

0 comments on commit 6e4ff37

Please sign in to comment.