From add7787614721f3545a40f5d31481fb8aaf74075 Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Thu, 9 Jan 2025 15:00:41 -0500 Subject: [PATCH] Hide azimuthalAngleIndicator when vertical, see https://github.com/phetsims/quantum-measurement/issues/54 --- js/common/view/BlochSphereNode.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/js/common/view/BlochSphereNode.ts b/js/common/view/BlochSphereNode.ts index 5445449..57a62ad 100644 --- a/js/common/view/BlochSphereNode.ts +++ b/js/common/view/BlochSphereNode.ts @@ -281,17 +281,21 @@ export default class BlochSphereNode extends Node { false ); - azimuthalAngleIndicator.shape = new Shape().ellipticalArc( - 0, - 0, - equatorSemiMajorAxis / 2, - equatorSemiMinorAxis / 2, - 0, - // Begins with offset; Ends at the azimuthal angle with an adjustement due to the sphere perspective - -xAxisOffsetAngle + Math.PI / 2, - -( azimuthalAngle + xAxisOffsetAngle - Math.PI / 2 ) % ( 2 * Math.PI ), - true - ); + if ( options.drawAngleIndicators && Math.abs( Math.sin( polarAngle ) ) > 1e-5 ) { + azimuthalAngleIndicator.shape = new Shape().ellipticalArc( + 0, + 0, + equatorSemiMajorAxis / 2, + equatorSemiMinorAxis / 2, + 0, + // Begins with offset; Ends at the azimuthal angle with an adjustement due to the sphere perspective + -xAxisOffsetAngle + Math.PI / 2, + -( azimuthalAngle + xAxisOffsetAngle - Math.PI / 2 ) % ( 2 * Math.PI ), + true + ); + azimuthalAngleIndicator.visible = true; + } + azimuthalAngleIndicator.visible = false; } ); }