Skip to content

Commit

Permalink
REVIEW comments, #32
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 4, 2024
1 parent 356ed7d commit 10c0ea5
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions js/common-sm/view/CustomLauncherSection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2023-2024, University of Colorado Boulder

//REVIEW Used only in Sources screen. Why is this in common-sm/?
/**
* This CustomLauncherSection is a panel section allows the user to customize a launcher.
*
Expand Down
2 changes: 2 additions & 0 deletions js/common-vsm/view/AngleStabilizerSection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright 2023-2024, University of Colorado Boulder

//REVIEW Doc says 'A specific NumberControl' but I see no use of NumberControl herein.
//REVIEW Used only in Sources screen, why is this in common-vsm/?
/**
* A specific NumberControl for this sim that changes the angle standard deviation for the launcher. Note that in the UI
* it is named "Angle Stabilizer" to convey the mechanism, but throughout the code the actual value that is being set
Expand Down
5 changes: 4 additions & 1 deletion js/common-vsm/view/HeatMapToolNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ type SelfOptions = {
export type HeatMapToolNodeOptions = SelfOptions & NodeOptions;

export default class HeatMapToolNode extends Node {

//REVIEW Lots of fields here that could use documentation.

private readonly minValue: number;
private readonly maxValue: number;
private readonly binWidth: number;
Expand Down Expand Up @@ -264,7 +267,7 @@ export default class HeatMapToolNode extends Node {
heatNodes.push( heatNode );

// Initialize the number of values in each bin to 0
this.numValuesInBin.push( 0 );
this.numValuesInBin.push( 0 ); //REVIEW This is a side effect that is not obvious. Are you sure you want to do this here? Maybe do this after calling createHeatNodes.
}

return heatNodes;
Expand Down
32 changes: 19 additions & 13 deletions js/common-vsm/view/InteractiveToolPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,25 @@ export default class InteractiveToolPanel extends PDLPanel {
const checkboxGroupTandem = options.tandem.createTandem( 'checkboxGroup' );
const stopwatchCheckboxTandemName = 'stopwatchCheckbox';

const checkboxGroup = new VerticalCheckboxGroup( [ {
property: isMeasuringTapeVisibleProperty,
createNode: () => new PDLCheckboxRow( ProjectileDataLabStrings.measuringTapeStringProperty, new MeasuringTapeIconNode() ),
tandemName: 'measuringTapeCheckbox'
}, {
property: isStopwatchVisibleProperty,
createNode: () => new PDLCheckboxRow( ProjectileDataLabStrings.stopwatchStringProperty, new StopwatchNodeIcon() ),
tandemName: stopwatchCheckboxTandemName,
options: {
visibleProperty: createGatedVisibleProperty( DerivedProperty.not( PDLPreferences.autoGenerateDataProperty ),
checkboxGroupTandem.createTandem( stopwatchCheckboxTandemName ) )
}
},
const checkboxGroup = new VerticalCheckboxGroup( [

// Measuring tape
{
property: isMeasuringTapeVisibleProperty,
createNode: () => new PDLCheckboxRow( ProjectileDataLabStrings.measuringTapeStringProperty, new MeasuringTapeIconNode() ),
tandemName: 'measuringTapeCheckbox'
},

// Stopwatch
{
property: isStopwatchVisibleProperty,
createNode: () => new PDLCheckboxRow( ProjectileDataLabStrings.stopwatchStringProperty, new StopwatchNodeIcon() ),
tandemName: stopwatchCheckboxTandemName,
options: {
visibleProperty: createGatedVisibleProperty( DerivedProperty.not( PDLPreferences.autoGenerateDataProperty ),
checkboxGroupTandem.createTandem( stopwatchCheckboxTandemName ) )
}
},
...options.additionalVerticalCheckboxGroupItems
], {
tandem: checkboxGroupTandem,
Expand Down
2 changes: 2 additions & 0 deletions js/common-vsm/view/ProjectileSelectorNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class ProjectileSelectorNode extends SelectorNode {
landedImageIndex?: number;
};

//REVIEW Does each instance need its own depictions, or can these be shared via 'const DEPICTIONS' outside the class definition?
const depictions: Depiction[] = [
{ type: CANNONBALL, isFlippedHorizontally: false },
{ type: CANNONBALL, isFlippedHorizontally: true },
Expand All @@ -100,6 +101,7 @@ export default class ProjectileSelectorNode extends SelectorNode {
{ type: PUMPKIN, isFlippedHorizontally: true, landedImageIndex: 2 }
];

//REVIEW My first thought was 'Does this need to be stateful?' If not, document why not.
const depictionProperty = new Property<Depiction>( depictions[ 0 ] );

const createNode = ( depiction: Depiction ) => {
Expand Down
2 changes: 2 additions & 0 deletions js/common-vsm/view/SpeedToolNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
type SelfOptions = {
isIcon?: boolean;
};

//REVIEW So complicated! So much simpler: SelfOptions & NodeTranslationOptions & PickOptional<HeatMapToolNodeOptions, 'visibleProperty'>
export type SpeedToolNodeOptions = SelfOptions & StrictOmit<HeatMapToolNodeOptions,
'displayOffset' | 'readoutPatternStringProperty' | 'bodyShape' | 'needleShape' | 'binWidth' | 'minValue'
| 'maxValue' | 'minLabeledValue' | 'maxLabeledValue' | 'labeledValueIncrement' | 'labelDistanceFromCenter' | 'labelMinAngle'
Expand Down
1 change: 1 addition & 0 deletions js/common-vsm/view/VSMFieldSignNode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2023-2024, University of Colorado Boulder

//REVIEW Incomplete doc. What does this class add to FieldSignNode?
/**
* The VSMFieldSignNode shows the field number and the number of projectiles that have landed in that field.
*
Expand Down

1 comment on commit 10c0ea5

@pixelzoom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.