From 3dfc9f3e7ffff6b6a0060db7d80e355f7d368f53 Mon Sep 17 00:00:00 2001 From: jbphet Date: Wed, 15 Jan 2025 16:00:32 -0700 Subject: [PATCH] only turn on precession when measurement is in progress, see https://github.com/phetsims/quantum-measurement/issues/80 --- js/bloch-sphere/model/BlochSphereModel.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/js/bloch-sphere/model/BlochSphereModel.ts b/js/bloch-sphere/model/BlochSphereModel.ts index 7d1866a..55ef563 100644 --- a/js/bloch-sphere/model/BlochSphereModel.ts +++ b/js/bloch-sphere/model/BlochSphereModel.ts @@ -201,21 +201,18 @@ class BlochSphereModel implements TModel { // Set the precession rate of the Bloch sphere based on the state of the magnetic field, the selected scene, and the // measurement state. Multilink.lazyMultilink( - [ this.magneticFieldStrengthProperty, this.magneticFieldEnabledProperty ], - ( magneticFieldStrength, showMagneticField ) => { + [ this.magneticFieldStrengthProperty, this.magneticFieldEnabledProperty, this.measurementStateProperty ], + ( magneticFieldStrength, showMagneticField, measurementState ) => { // Changes to the field state should clear any accumulated counts. this.resetCounts(); - // Set the precession rate of the Bloch sphere based on the state of the magnetic field. - - this.singleMeasurementBlochSphere.rotatingSpeedProperty.value = showMagneticField ? - magneticFieldStrength : - 0; + // Set the precession rate of the Bloch sphere based on the measurement state and the state of the magnetic + // field. + const rotationRate = measurementState === 'timingObservation' && showMagneticField ? magneticFieldStrength : 0; + this.singleMeasurementBlochSphere.rotatingSpeedProperty.value = rotationRate; this.multiMeasurementBlochSpheres.forEach( blochSphere => { - blochSphere.rotatingSpeedProperty.value = showMagneticField ? - magneticFieldStrength : - 0; + blochSphere.rotatingSpeedProperty.value = rotationRate; } ); } );