Skip to content

Commit

Permalink
Workaround to fix layout on SG, see #53
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Nov 18, 2024
1 parent 132d6ff commit 7ea5e1a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/spin/view/SpinMeasurementArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import DerivedStringProperty from '../../../../axon/js/DerivedStringProperty.js';
import Multilink from '../../../../axon/js/Multilink.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import Bounds2 from '../../../../dot/js/Bounds2.js';
import Utils from '../../../../dot/js/Utils.js';
Expand Down Expand Up @@ -79,6 +80,7 @@ export default class SpinMeasurementArea extends VBox {
{ tandem: tandem.createTandem( 'thirdSternGerlachNode' ) } )
];

// TODO: Move all these into the SG Nodes, https://github.com/phetsims/quantum-measurement/issues/53
const createOrientationRadioButtonGroup = ( sternGerlach: SternGerlach, tandem: Tandem ) => {
const radioButtonTextOptions: RichTextOptions = {
font: new PhetFont( 18 ),
Expand Down Expand Up @@ -122,6 +124,15 @@ export default class SpinMeasurementArea extends VBox {
]
} );

// TODO: WORKAROUND Move all these into the SG Nodes, https://github.com/phetsims/quantum-measurement/issues/53
Multilink.multilink(
[ model.isCustomExperimentProperty, model.particleSourceModel.isContinuousModeProperty ],
( isCustomExperiment, isContinuousMode ) => {
firstSternGerlachControls.left = sternGerlachNodes[ 0 ].left;
firstSternGerlachControls.top = sternGerlachNodes[ 0 ].bottom + 10;
}
);

const secondAndThirdSternGerlachControl = createOrientationRadioButtonGroup( model.sternGerlachs[ 2 ], tandem.createTandem( 'secondAndThirdSternGerlachControl' ) );
model.blockUpperExitProperty.link( blockUpperExit => {
const referenceIndex = blockUpperExit ? 2 : 1;
Expand Down

0 comments on commit 7ea5e1a

Please sign in to comment.