Skip to content

Commit

Permalink
remove mockup for 4th screen and all mockup support, see #54 and #3 and
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jan 3, 2025
1 parent 30f3efc commit 958ee52
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 124 deletions.
Binary file removed images/blochSphereScreenMockup.png
Binary file not shown.
10 changes: 0 additions & 10 deletions images/blochSphereScreenMockup_png.ts

This file was deleted.

8 changes: 0 additions & 8 deletions images/license.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"blochSphereScreenMockup.png": {
"text": [
"Copyright 2023 University of Colorado Boulder"
],
"projectURL": "https://phet.colorado.edu",
"license": "contact [email protected]",
"notes": "created by Ariel Paul as part of design process"
},
"coinsScreenMockup.png": {
"text": [
"Copyright 2023 University of Colorado Boulder"
Expand Down
12 changes: 2 additions & 10 deletions js/bloch-sphere/view/BlochSphereScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
*/

import BlochSphereModel from 'model/BlochSphereModel.js';
import ScreenView from '../../../../joist/js/ScreenView.js';
import PhetFont from '../../../../scenery-phet/js/PhetFont.js';
import { Color, Image, Line, Text, VBox } from '../../../../scenery/js/imports.js';
import { Color, Line, Text, VBox } from '../../../../scenery/js/imports.js';
import ComboBox, { ComboBoxItem } from '../../../../sun/js/ComboBox.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import blochSphereScreenMockup_png from '../../../images/blochSphereScreenMockup_png.js';
import QuantumMeasurementScreenView from '../../common/view/QuantumMeasurementScreenView.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import { BlochSphereScene } from '../model/BlochSphereScene.js';
Expand All @@ -23,13 +21,7 @@ export default class BlochSphereScreenView extends QuantumMeasurementScreenView

public constructor( model: BlochSphereModel, tandem: Tandem ) {

super( {
initialMockupOpacity: 0,
mockupImage: new Image( blochSphereScreenMockup_png, {
scale: ScreenView.DEFAULT_LAYOUT_BOUNDS.width / blochSphereScreenMockup_png.width
} ),
tandem: tandem
} );
super( { tandem: tandem } );

const preparationArea = new BlochSpherePreparationArea( model, this, {
left: this.layoutBounds.left + 20,
Expand Down
14 changes: 3 additions & 11 deletions js/coins/view/CoinsScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ export default class CoinsScreenView extends QuantumMeasurementScreenView {

public constructor( model: CoinsModel, tandem: Tandem ) {

super( {
initialMockupOpacity: 0,
tandem: tandem
} );
super( { tandem: tandem } );

this.model = model;

Expand All @@ -67,11 +64,6 @@ export default class CoinsScreenView extends QuantumMeasurementScreenView {
} );
this.addChild( this.quantumCoinsExperimentSceneView );

// Move the mockup image to the front of the Z-order for easier comparisons with added UI elements.
if ( this.mockupImage ) {
this.mockupImage.moveToFront();
}

// Changing the background color based on the experiment type
Multilink.multilink(
[
Expand All @@ -80,8 +72,8 @@ export default class CoinsScreenView extends QuantumMeasurementScreenView {
QuantumMeasurementColors.quantumBackgroundColorProperty
],
( experimentType, classicalBackgroundColor, quantumBackgroundColor ) => {
QuantumMeasurementColors.screenBackgroundColorProperty.value = experimentType === 'classical' ? classicalBackgroundColor : quantumBackgroundColor;
} );
QuantumMeasurementColors.screenBackgroundColorProperty.value = experimentType === 'classical' ? classicalBackgroundColor : quantumBackgroundColor;
} );
}

public override reset(): void {
Expand Down
41 changes: 0 additions & 41 deletions js/common/MockupOpacitySlider.ts

This file was deleted.

45 changes: 6 additions & 39 deletions js/common/view/QuantumMeasurementScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,21 @@
* @author John Blanco, PhET Interactive Simulations
*/

import NumberProperty from '../../../../axon/js/NumberProperty.js';
import ScreenView, { ScreenViewOptions } from '../../../../joist/js/ScreenView.js';
import optionize from '../../../../phet-core/js/optionize.js';
import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import WithRequired from '../../../../phet-core/js/types/WithRequired.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import { Image } from '../../../../scenery/js/imports.js';
import MockupOpacitySlider from '../../common/MockupOpacitySlider.js';
import QuantumMeasurementConstants from '../../common/QuantumMeasurementConstants.js';
import quantumMeasurement from '../../quantumMeasurement.js';

type SelfOptions = {

// image source for a mockup that will be added to the background if provided
mockupImage?: Image | null;

initialMockupOpacity?: number;
};

type QuantumMeasurementScreenViewOptions = SelfOptions & ScreenViewOptions;
type SelfOptions = EmptySelfOptions;
type QuantumMeasurementScreenViewOptions = SelfOptions & WithRequired<ScreenViewOptions, 'tandem'>;

export default class QuantumMeasurementScreenView extends ScreenView {

// Mockup image, made available to subclasses in case they want to adjust the Z-order.
protected readonly mockupImage: Image | null = null;
protected readonly mockupOpacityProperty: NumberProperty | null = null;

public constructor( providedOptions: QuantumMeasurementScreenViewOptions ) {

const options = optionize<QuantumMeasurementScreenViewOptions, SelfOptions, ScreenViewOptions>()( {
mockupImage: null,
initialMockupOpacity: 1
}, providedOptions );

super( options );

// Add a screen mockup if one has been provided.
// TODO: This is for early prototyping and should be removed eventually, see https://github.com/phetsims/quantum-measurement/issues/3.
if ( options.mockupImage !== null && !phet.chipper.queryParameters.fuzz ) {

this.mockupImage = options.mockupImage;

this.addChild( options.mockupImage );

assert && assert( options.initialMockupOpacity >= 0 && options.initialMockupOpacity <= 1 );
this.mockupOpacityProperty = new NumberProperty( options.initialMockupOpacity );

// Add a slider that can be used to control the mockup opacity.
this.addChild( new MockupOpacitySlider( this.mockupOpacityProperty, options.mockupImage ) );
}
super( providedOptions );

const resetAllButton = new ResetAllButton( {
listener: () => {
Expand All @@ -62,7 +29,7 @@ export default class QuantumMeasurementScreenView extends ScreenView {
},
right: this.layoutBounds.maxX - QuantumMeasurementConstants.SCREEN_VIEW_X_MARGIN,
bottom: this.layoutBounds.maxY - QuantumMeasurementConstants.SCREEN_VIEW_Y_MARGIN,
tandem: options.tandem.createTandem( 'resetAllButton' )
tandem: providedOptions.tandem.createTandem( 'resetAllButton' )
} );
this.addChild( resetAllButton );
}
Expand Down
1 change: 0 additions & 1 deletion js/photons/view/PhotonsScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class PhotonsScreenView extends QuantumMeasurementScreenView {

super( {
children: [ experimentModeRadioButtonGroup, singlePhotonExperimentSceneView, manyPhotonsExperimentSceneView ],
initialMockupOpacity: 0,
tandem: tandem
} );

Expand Down
5 changes: 1 addition & 4 deletions js/spin/view/SpinScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export default class SpinScreenView extends QuantumMeasurementScreenView {

public constructor( public readonly model: SpinModel, tandem: Tandem ) {

super( {
initialMockupOpacity: 0,
tandem: tandem
} );
super( { tandem: tandem } );

const spinStatePreparationArea = new SpinStatePreparationArea(
model,
Expand Down

0 comments on commit 958ee52

Please sign in to comment.