-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
factor out GOSim.ts, phetsims/geometric-optics-basics#2
- Loading branch information
Showing
2 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2022, University of Colorado Boulder | ||
|
||
/** | ||
* GOSim is the subclass of Sim used by both the 'full' and 'basics' versions of Geometric Optics. | ||
* | ||
* @author Chris Malley (PixelZoom, Inc.) | ||
*/ | ||
|
||
import Sim from '../../joist/js/Sim.js'; | ||
import merge from '../../phet-core/js/merge.js'; | ||
import Tandem from '../../tandem/js/Tandem.js'; | ||
import geometricOptics from './geometricOptics.js'; | ||
import LensScreen from './lens/LensScreen.js'; | ||
import MirrorScreen from './mirror/MirrorScreen.js'; | ||
import GOConstants from './common/GOConstants.js'; | ||
import { Node } from '../../scenery/js/imports.js'; | ||
|
||
type GOSimOptions = { | ||
isBasicsVersion?: boolean, | ||
createOptionsDialogContent?: ( tandem: Tandem ) => Node | ||
}; | ||
|
||
class GOSim extends Sim { | ||
|
||
/** | ||
* @param title | ||
* @param providedOptions | ||
*/ | ||
constructor( title: string, providedOptions?: GOSimOptions ) { | ||
|
||
const options = merge( { | ||
credits: GOConstants.CREDITS, | ||
|
||
// pdom options | ||
hasKeyboardHelpContent: true | ||
}, providedOptions ); | ||
|
||
super( title, [ | ||
new LensScreen( { | ||
isBasicsVersion: options.isBasicsVersion, | ||
tandem: Tandem.ROOT.createTandem( 'lensScreen' ) | ||
} ), | ||
new MirrorScreen( { | ||
isBasicsVersion: options.isBasicsVersion, | ||
tandem: Tandem.ROOT.createTandem( 'mirrorScreen' ) | ||
} ) | ||
], options ); | ||
} | ||
} | ||
|
||
geometricOptics.register( 'GOSim', GOSim ); | ||
export default GOSim; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters