Skip to content

Commit

Permalink
In chart-intro files: clean up documentation to be more like sentence…
Browse files Browse the repository at this point in the history
…s. Shorten code to follow 120 column width recommendation. See #176 and #173.
  • Loading branch information
Luisav1 committed Aug 30, 2023
1 parent 9c97e5e commit e21517b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion js/chart-intro/model/ChartIntroModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class ChartIntroModel extends BANModel<ParticleNucleus> {

const particleAtom = new ParticleNucleus(); // This is our ground truth 'atom'.

// Empirically determined, the last nuclide the NuclideChartIntro screen goes up to is Neon-22 (10p and 12n).
// Empirically determined, the last nuclide the NuclideChartIntro screen goes up to is Neon-22 (10 protons
// and 12 neutrons).
super( BANConstants.CHART_MAX_NUMBER_OF_PROTONS, BANConstants.CHART_MAX_NUMBER_OF_NEUTRONS, particleAtom );

this.particleNucleus = particleAtom;
Expand Down
3 changes: 2 additions & 1 deletion js/chart-intro/model/ParticleNucleus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ class ParticleNucleus extends ParticleAtom {
N_ZERO_CAPACITY - 1 : N_ONE_CAPACITY - 1;

// Amount each particle moves so the space between it and the particle on its left is removed.
const boundOffset = n1levelWidth * ( levelIndex / ( 3 * N_ONE_CAPACITY - 1 ) ); // 3 radius spaces / particle * 5 particle spaces
const boundOffset = n1levelWidth *
( levelIndex / ( 3 * N_ONE_CAPACITY - 1 ) ); // 3 radius spaces / particle * 5 particle spaces

// Amount each particle has to move for all particles to be centered in middle of energy level.
const centerOffset = BANConstants.PARTICLE_RADIUS * numberOfRadiusSpaces / 2;
Expand Down
2 changes: 1 addition & 1 deletion js/chart-intro/view/ChartIntroScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class ChartIntroScreenView extends BANScreenView<ChartIntroModel> {
public override emitNucleon( particleType: ParticleType, particleAtom: ParticleAtom ): void {
this.isMiniAtomConnected = false;

// Handle the animation for the mini ParticleAtom
// Handle the animation for the mini ParticleAtom.
super.emitNucleon( particleType, this.model.miniParticleAtom );
this.model.miniParticleAtom.reconfigureNucleus();

Expand Down
2 changes: 1 addition & 1 deletion js/chart-intro/view/NuclideChartAndNumberLines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NuclideChartAndNumberLines extends Node {
neutronNumberLine.left = protonNumberLine.right;

// The numberLine's origin is at 0 in model coordinates, but because of how we position the labels offset from the
// tick marks (see NucleonNumberLine), we need to do that here too
// tick marks (see NucleonNumberLine), we need to do that here too.
nuclideChartNode.left = neutronNumberLine.localToParentPoint( Vector2.ZERO ).x
- chartTransform.modelToViewX( tickSpacing );

Expand Down
2 changes: 1 addition & 1 deletion js/chart-intro/view/NuclideChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class NuclideChartNode extends Node {
decayType === DecayType.BETA_PLUS_DECAY ? new Vector2( neutronNumber + 1, protonNumber - 1 ) :
decayType === DecayType.BETA_MINUS_DECAY ? new Vector2( neutronNumber - 1, protonNumber + 1 ) :

// Alpha decay
// Alpha decay.
new Vector2( neutronNumber - AlphaParticle.NUMBER_OF_ALLOWED_NEUTRONS,
protonNumber - AlphaParticle.NUMBER_OF_ALLOWED_PROTONS );
const arrowTip = chartTransform.modelToViewXY(
Expand Down
2 changes: 1 addition & 1 deletion js/chart-intro/view/ZoomInNuclideChartIconNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ZoomInNuclideChartIconNode extends Node {
squareLength, squareLength );
cellLayerNode.clipArea = zoomInShape;

// add the border outline to the chart
// Add the border outline to the chart.
const borderPath = new Path( zoomInShape, { stroke: Color.BLACK, lineWidth: 0.5 } );

super( { children: [ cellLayerNode, borderPath ] } );
Expand Down

0 comments on commit e21517b

Please sign in to comment.