From 34c6b6a3c878b890e310d886ad42e4f7ffc79219 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 22 Feb 2022 08:03:54 -0700 Subject: [PATCH] geometric-optics-basics initial setup, https://github.com/phetsims/geometric-optics-basics/issues/2 --- geometric-optics-basics_a11y_view.html | 552 ++++++++++++++++++ geometric-optics-basics_en.html | 25 +- js/common/GeometricOpticsBasicsColors.ts | 29 - js/common/GeometricOpticsBasicsConstants.ts | 20 - .../GeometricOpticsBasicsQueryParameters.ts | 29 - js/geometric-optics-basics-main.ts | 35 +- ...ometric-optics-basics-phet-io-overrides.js | 2 + .../GeometricOpticsBasicsScreen.ts | 43 -- .../model/GeometricOpticsBasicsModel.ts | 37 -- .../view/GeometricOpticsBasicsScreenView.ts | 64 -- package.json | 12 + tsconfig.json | 3 + 12 files changed, 606 insertions(+), 245 deletions(-) create mode 100644 geometric-optics-basics_a11y_view.html delete mode 100644 js/common/GeometricOpticsBasicsColors.ts delete mode 100644 js/common/GeometricOpticsBasicsConstants.ts delete mode 100644 js/common/GeometricOpticsBasicsQueryParameters.ts create mode 100644 js/geometric-optics-basics-phet-io-overrides.js delete mode 100644 js/geometric-optics-basics/GeometricOpticsBasicsScreen.ts delete mode 100644 js/geometric-optics-basics/model/GeometricOpticsBasicsModel.ts delete mode 100644 js/geometric-optics-basics/view/GeometricOpticsBasicsScreenView.ts diff --git a/geometric-optics-basics_a11y_view.html b/geometric-optics-basics_a11y_view.html new file mode 100644 index 0000000..8bc706b --- /dev/null +++ b/geometric-optics-basics_a11y_view.html @@ -0,0 +1,552 @@ + + + + + + + + + + + + + A11y View: Geometric Optics: Basics + + + + + + +
+ +
+
+

A11y View: Geometric Optics: Basics

+
+ About the A11y View Tool +

+ The A11y View is a design and presentation tool that we use to visually review and demonstrate the Interactive Description design of a simulation. The descriptions we design live within our accessibility layer, we call the Parallel DOM, or PDOM. The HTML of the PDOM provides document and interaction semantics for State Descriptions (copied into the blue box), and timely delivery of Responsive Descriptions (copied into the orange box). For a learner accessing the simulation with screen reader software, the State Descriptions provide on-demand access the current state of simulation while Responsive Descriptions deliver relevant changes - in real time - as the learner interacts with the simulation. +

+

+ Please note that learners who use screen reader software do not use this A11y View, they use the same simulation that all learners use. +

+
+
+ + +
+
+ +
+
+

Activity log of Responsive Descriptions

+
+ About Responsive Descriptions + Responsive Descriptions deliver changes made to interactive objects (Object Responses) and changes to the surrounding context (Context Responses). Only responses powered by ARIA Live appear in the activity log below, and most are Context Responses. Most responses powered by ARIA Live are delivered politely, but some are really important so we make them assertive (occasional line highlighted in pink). Note that many Object Responses are delivered using the aria-valuetext attribute (see grey text under slider interactions in the blue box). +
+ +
+
+ + + + + +
+
+ +
+ + + + + + + + diff --git a/geometric-optics-basics_en.html b/geometric-optics-basics_en.html index 8a9096f..3fc7808 100644 --- a/geometric-optics-basics_en.html +++ b/geometric-optics-basics_en.html @@ -33,13 +33,24 @@ }, "phet": { "requirejsNamespace": "GEOMETRIC_OPTICS_BASICS", + "phetLibs": [ + "geometric-optics" + ], + "colorProfiles": [ + "default", + "projector" + ], "simulation": true, "runnable": true, - "readmeCreatedManually": true, "supportedBrands": [ "phet", + "phet-io", "adapted-from-phet" ], + "simFeatures": { + "supportsSound": true, + "supportsInteractiveDescription": true + }, "supportsOutputJS": true }, "eslintConfig": { @@ -48,6 +59,14 @@ }; window.phet.chipper.stringRepos = [ + { + "repo": "geometric-optics", + "requirejsNamespace": "GEOMETRIC_OPTICS" + }, + { + "repo": "geometric-optics-basics", + "requirejsNamespace": "GEOMETRIC_OPTICS_BASICS" + }, { "repo": "joist", "requirejsNamespace": "JOIST" @@ -56,10 +75,6 @@ "repo": "scenery-phet", "requirejsNamespace": "SCENERY_PHET" }, - { - "repo": "geometric-optics-basics", - "requirejsNamespace": "GEOMETRIC_OPTICS_BASICS" - }, { "repo": "sun", "requirejsNamespace": "SUN" diff --git a/js/common/GeometricOpticsBasicsColors.ts b/js/common/GeometricOpticsBasicsColors.ts deleted file mode 100644 index f859aa3..0000000 --- a/js/common/GeometricOpticsBasicsColors.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * Defines the colors for this sim. - * - * All simulations should have a Colors.js file, see https://github.com/phetsims/scenery-phet/issues/642. - * - * For static colors that are used in more than one place, add them here. - * - * For dynamic colors that can be controlled via colorProfileProperty.js, add instances of ProfileColorProperty here, - * each of which is required to have a default color. Note that dynamic colors can be edited by running the sim from - * phetmarks using the "Color Edit" mode. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import { ProfileColorProperty } from '../../../scenery/js/imports.js'; -import geometricOpticsBasics from '../geometricOpticsBasics.js'; - -const geometricOpticsBasicsColors = { - - // Background color that for screens in this sim - screenBackgroundColorProperty: new ProfileColorProperty( geometricOpticsBasics, 'background', { - default: 'white' - } ) -}; - -geometricOpticsBasics.register( 'geometricOpticsBasicsColors', geometricOpticsBasicsColors ); -export default geometricOpticsBasicsColors; \ No newline at end of file diff --git a/js/common/GeometricOpticsBasicsConstants.ts b/js/common/GeometricOpticsBasicsConstants.ts deleted file mode 100644 index 0225445..0000000 --- a/js/common/GeometricOpticsBasicsConstants.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * Constants used throughout this simulation. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import geometricOpticsBasics from '../geometricOpticsBasics.js'; - -const GeometricOpticsBasicsConstants = { - - SCREEN_VIEW_X_MARGIN: 15, - SCREEN_VIEW_Y_MARGIN: 15 - - //TODO -}; - -geometricOpticsBasics.register( 'GeometricOpticsBasicsConstants', GeometricOpticsBasicsConstants ); -export default GeometricOpticsBasicsConstants; \ No newline at end of file diff --git a/js/common/GeometricOpticsBasicsQueryParameters.ts b/js/common/GeometricOpticsBasicsQueryParameters.ts deleted file mode 100644 index 1ecc974..0000000 --- a/js/common/GeometricOpticsBasicsQueryParameters.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * Defines query parameters that are specific to this simulation. - * Run with ?log to print query parameters and their values to the browser console at startup. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import logGlobal from '../../../phet-core/js/logGlobal.js'; -import geometricOpticsBasics from '../geometricOpticsBasics.js'; - -const SCHEMA_MAP = { - //TODO add schemas for query parameters -}; - -const GeometricOpticsBasicsQueryParameters = QueryStringMachine.getAll( SCHEMA_MAP ); - -// The schema map is a read-only part of the public API, in case schema details (e.g. validValues) are needed elsewhere. -GeometricOpticsBasicsQueryParameters.SCHEMA_MAP = SCHEMA_MAP; - -geometricOpticsBasics.register( 'GeometricOpticsBasicsQueryParameters', GeometricOpticsBasicsQueryParameters ); - -// Log query parameters -logGlobal( 'phet.chipper.queryParameters' ); -logGlobal( 'phet.preloads.phetio.queryParameters' ); -logGlobal( 'phet.geometricOpticsBasics.GeometricOpticsBasicsQueryParameters' ); - -export default GeometricOpticsBasicsQueryParameters; \ No newline at end of file diff --git a/js/geometric-optics-basics-main.ts b/js/geometric-optics-basics-main.ts index 57c94cd..985397f 100644 --- a/js/geometric-optics-basics-main.ts +++ b/js/geometric-optics-basics-main.ts @@ -6,33 +6,32 @@ * @author Chris Malley (PixelZoom, Inc.) */ +import GOConstants from '../../geometric-optics/js/common/GOConstants.js'; +import GOGlobalOptionsNode from '../../geometric-optics/js/common/view/GOGlobalOptionsNode.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 simLauncher from '../../joist/js/simLauncher.js'; import Tandem from '../../tandem/js/Tandem.js'; -import GeometricOpticsBasicsScreen from './geometric-optics-basics/GeometricOpticsBasicsScreen.js'; import geometricOpticsBasicsStrings from './geometricOpticsBasicsStrings.js'; -const geometricOpticsBasicsTitleString = geometricOpticsBasicsStrings[ 'geometric-optics-basics' ].title; - const simOptions = { - //TODO fill in credits, all of these fields are optional, see joist.CreditsNode - credits: { - leadDesign: '', - softwareDevelopment: '', - team: '', - qualityAssurance: '', - graphicArts: '', - soundDesign: '', - thanks: '' - } + credits: GOConstants.CREDITS, + + // Creates content for the Options dialog, accessible via the PhET menu + createOptionsDialogContent: ( tandem: Tandem ) => new GOGlobalOptionsNode( { + tandem: tandem + } ), + + // pdom options + hasKeyboardHelpContent: true }; -// launch the sim - beware that scenery Image nodes created outside of simLauncher.launch() will have zero bounds -// until the images are fully loaded, see https://github.com/phetsims/coulombs-law/issues/70 simLauncher.launch( () => { - const sim = new Sim( geometricOpticsBasicsTitleString, [ - new GeometricOpticsBasicsScreen( { tandem: Tandem.ROOT.createTandem( 'geometricOpticsBasicsScreen' ) } ) + const sim = new Sim( geometricOpticsBasicsStrings[ 'geometric-optics-basics' ].title, [ + new LensScreen( { tandem: Tandem.ROOT.createTandem( 'lensScreen' ) } ), + new MirrorScreen( { tandem: Tandem.ROOT.createTandem( 'mirrorScreen' ) } ) ], simOptions ); sim.start(); -} ); \ No newline at end of file +} ); diff --git a/js/geometric-optics-basics-phet-io-overrides.js b/js/geometric-optics-basics-phet-io-overrides.js new file mode 100644 index 0000000..116f545 --- /dev/null +++ b/js/geometric-optics-basics-phet-io-overrides.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +window.phet.preloads.phetio.phetioElementsOverrides = {}; \ No newline at end of file diff --git a/js/geometric-optics-basics/GeometricOpticsBasicsScreen.ts b/js/geometric-optics-basics/GeometricOpticsBasicsScreen.ts deleted file mode 100644 index 1fafcac..0000000 --- a/js/geometric-optics-basics/GeometricOpticsBasicsScreen.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * TODO Describe this class and its responsibilities. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import Screen, { ScreenOptions } from '../../../joist/js/Screen.js'; -import optionize from '../../../phet-core/js/optionize.js'; -import Tandem from '../../../tandem/js/Tandem.js'; -import GeometricOpticsBasicsColors from '../common/GeometricOpticsBasicsColors.js'; -import geometricOpticsBasics from '../geometricOpticsBasics.js'; -import GeometricOpticsBasicsModel from './model/GeometricOpticsBasicsModel.js'; -import GeometricOpticsBasicsScreenView from './view/GeometricOpticsBasicsScreenView.js'; -import { PhetioObjectOptions } from '../../../tandem/js/PhetioObject.js'; - -type GeometricOpticsBasicsScreenSelfOptions = Required>; -type GeometricOpticsBasicsScreenOptions = GeometricOpticsBasicsScreenSelfOptions & ScreenOptions; - -class GeometricOpticsBasicsScreen extends Screen { - - constructor( providedOptions: GeometricOpticsBasicsScreenOptions ) { - - const options = optionize( { - - //TODO if you include homeScreenIcon or navigationBarIcon, use JOIST/ScreenIcon - backgroundColorProperty: GeometricOpticsBasicsColors.screenBackgroundColorProperty, - - // phet-io options - tandem: Tandem.REQUIRED - }, providedOptions ); - - super( - () => new GeometricOpticsBasicsModel( { tandem: options.tandem.createTandem( 'model' ) } ), - model => new GeometricOpticsBasicsScreenView( model, { tandem: options.tandem.createTandem( 'view' ) } ), - options - ); - } -} - -geometricOpticsBasics.register( 'GeometricOpticsBasicsScreen', GeometricOpticsBasicsScreen ); -export default GeometricOpticsBasicsScreen; \ No newline at end of file diff --git a/js/geometric-optics-basics/model/GeometricOpticsBasicsModel.ts b/js/geometric-optics-basics/model/GeometricOpticsBasicsModel.ts deleted file mode 100644 index b4dfad6..0000000 --- a/js/geometric-optics-basics/model/GeometricOpticsBasicsModel.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * TODO Describe this class and its responsibilities. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import geometricOpticsBasics from '../../geometricOpticsBasics.js'; -import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js'; - -type GeometricOpticsBasicsModelOptions = Required>; - -class GeometricOpticsBasicsModel { - - constructor( providedOptions: GeometricOpticsBasicsModelOptions ) { - //TODO - } - - /** - * Resets the model. - */ - public reset(): void { - //TODO - } - - /** - * Steps the model. - * @param dt - time step, in seconds - */ - public step( dt: number ): void { - //TODO - } -} - -geometricOpticsBasics.register( 'GeometricOpticsBasicsModel', GeometricOpticsBasicsModel ); -export default GeometricOpticsBasicsModel; \ No newline at end of file diff --git a/js/geometric-optics-basics/view/GeometricOpticsBasicsScreenView.ts b/js/geometric-optics-basics/view/GeometricOpticsBasicsScreenView.ts deleted file mode 100644 index 66eafb4..0000000 --- a/js/geometric-optics-basics/view/GeometricOpticsBasicsScreenView.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022, University of Colorado Boulder - -/** - * TODO Describe this class and its responsibilities. - * - * @author Chris Malley (PixelZoom, Inc.) - */ - -import ScreenView, { ScreenViewOptions } from '../../../../joist/js/ScreenView.js'; -import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js'; -import Tandem from '../../../../tandem/js/Tandem.js'; -import GeometricOpticsBasicsConstants from '../../common/GeometricOpticsBasicsConstants.js'; -import geometricOpticsBasics from '../../geometricOpticsBasics.js'; -import GeometricOpticsBasicsModel from '../model/GeometricOpticsBasicsModel.js'; -import optionize from '../../../../phet-core/js/optionize.js'; -import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js'; -import { ScreenOptions } from '../../../../joist/js/Screen.js'; - -type GeometricOpticsBasicsScreenViewSelfOptions = Required>; -type GeometricOpticsBasicsScreenViewOptions = GeometricOpticsBasicsScreenViewSelfOptions & ScreenOptions; - -class GeometricOpticsBasicsScreenView extends ScreenView { - - constructor( model: GeometricOpticsBasicsModel, providedOptions: GeometricOpticsBasicsScreenViewOptions ) { - - const options = optionize( { - - // phet-io options - tandem: Tandem.REQUIRED - }, providedOptions ); - - super( options ); - - const resetAllButton = new ResetAllButton( { - listener: () => { - this.interruptSubtreeInput(); // cancel interactions that may be in progress - model.reset(); - this.reset(); - }, - right: this.layoutBounds.maxX - GeometricOpticsBasicsConstants.SCREEN_VIEW_X_MARGIN, - bottom: this.layoutBounds.maxY - GeometricOpticsBasicsConstants.SCREEN_VIEW_Y_MARGIN, - tandem: options.tandem.createTandem( 'resetAllButton' ) - } ); - this.addChild( resetAllButton ); - } - - /** - * Resets the view. - */ - public reset(): void { - //TODO - } - - /** - * Steps the view. - * @param dt - time step, in seconds - */ - public step( dt: number ): void { - //TODO - } -} - -geometricOpticsBasics.register( 'GeometricOpticsBasicsScreenView', GeometricOpticsBasicsScreenView ); -export default GeometricOpticsBasicsScreenView; \ No newline at end of file diff --git a/package.json b/package.json index e65c623..d54b00b 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,24 @@ }, "phet": { "requirejsNamespace": "GEOMETRIC_OPTICS_BASICS", + "phetLibs": [ + "geometric-optics" + ], + "colorProfiles": [ + "default", + "projector" + ], "simulation": true, "runnable": true, "supportedBrands": [ "phet", + "phet-io", "adapted-from-phet" ], + "simFeatures": { + "supportsSound": true, + "supportsInteractiveDescription": true + }, "supportsOutputJS": true }, "eslintConfig": { diff --git a/tsconfig.json b/tsconfig.json index 02329bf..efdcc1e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,9 @@ "references": [ { "path": "../joist/tsconfig-module.json" + }, + { + "path": "../geometric-optics" } ], "include": [