Skip to content

Commit

Permalink
new strings and layout for sound options content, see #282
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Mar 22, 2023
1 parent ccae67a commit 9ec50c3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
5 changes: 3 additions & 2 deletions js/QuadrilateralStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ type StringsType = {
'shapeSoundOptionsStringProperty': LinkableProperty<string>;
'shapeSoundOptionsDescriptionStringProperty': LinkableProperty<string>;
'layerSoundDesignDescriptionStringProperty': LinkableProperty<string>;
'independentSoundDesignDescriptionStringProperty': LinkableProperty<string>;
'playSoundsForeverStringProperty': LinkableProperty<string>;
'emphasisSoundDesignDescriptionStringProperty': LinkableProperty<string>;
'soundsPlayForeverDescriptionStringProperty': LinkableProperty<string>;
'soundsPlayForeverLabelStringProperty': LinkableProperty<string>;
};
'smallStepsStringProperty': LinkableProperty<string>;
'a11y': {
Expand Down
30 changes: 17 additions & 13 deletions js/quadrilateral/view/sound/QuadrilateralSoundOptionsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import PreferencesPanelSection from '../../../../../joist/js/preferences/Prefere
import AquaRadioButton from '../../../../../sun/js/AquaRadioButton.js';
import QuadrilateralStrings from '../../../QuadrilateralStrings.js';
import soundManager from '../../../../../tambo/js/soundManager.js';
import Vector2 from '../../../../../dot/js/Vector2.js';

// constants
const shapeSoundsOptionsStringProperty = QuadrilateralStrings.preferencesDialog.shapeSoundOptionsStringProperty;
const shapeSoundsOptionsDescriptionStringProperty = QuadrilateralStrings.preferencesDialog.shapeSoundOptionsDescriptionStringProperty;
const preferencesDialogLayerSoundDesignDescriptionStringProperty = QuadrilateralStrings.preferencesDialog.layerSoundDesignDescriptionStringProperty;
const preferencesDialogIndependentSoundDesignDescriptionStringProperty = QuadrilateralStrings.preferencesDialog.independentSoundDesignDescriptionStringProperty;
const preferencesDialogPlaySoundsForeverStringProperty = QuadrilateralStrings.preferencesDialog.playSoundsForeverStringProperty;
const preferencesDialogEmphasisSoundDesignDescriptionStringProperty = QuadrilateralStrings.preferencesDialog.emphasisSoundDesignDescriptionStringProperty;
const preferencesDialogSoundsPlayForeverLabelStringProperty = QuadrilateralStrings.preferencesDialog.soundsPlayForeverLabelStringProperty;
const preferencesDialogSoundsPlayForeverDescriptionStringProperty = QuadrilateralStrings.preferencesDialog.soundsPlayForeverDescriptionStringProperty;
const tracksPlayForeverCheckedContextResponseStringProperty = QuadrilateralStrings.a11y.preferencesDialog.tracksPlayForeverCheckbox.checkedContextResponseStringProperty;
const tracksPlayForeverUncheckedContextResponseStringProperty = QuadrilateralStrings.a11y.preferencesDialog.tracksPlayForeverCheckbox.uncheckedContextResponseStringProperty;

Expand All @@ -34,7 +36,7 @@ export default class QuadrilateralSoundOptionsNode extends PreferencesPanelSecti

public constructor( model: QuadrilateralSoundOptionsModel, tandem: Tandem ) {

const soundDesignLabelText = new VoicingText( shapeSoundsOptionsStringProperty, PreferencesDialog.PANEL_SECTION_LABEL_OPTIONS );
const soundDesignLabelText = new Text( shapeSoundsOptionsStringProperty, PreferencesDialog.PANEL_SECTION_LABEL_OPTIONS );
const soundDesignDescriptionText = new VoicingText( shapeSoundsOptionsDescriptionStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS );

const soundDesignRadioButtonGroup = new AquaRadioButtonGroup( model.soundDesignProperty, [
Expand All @@ -48,10 +50,10 @@ export default class QuadrilateralSoundOptionsNode extends PreferencesPanelSecti
},
{
value: SoundDesign.TRACKS_EMPHASIS,
createNode: () => new Text( preferencesDialogIndependentSoundDesignDescriptionStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS ),
createNode: () => new Text( preferencesDialogEmphasisSoundDesignDescriptionStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS ),
tandemName: `emphasisTracksSoundView${AquaRadioButton.TANDEM_NAME_SUFFIX}`,
options: {
voicingNameResponse: preferencesDialogIndependentSoundDesignDescriptionStringProperty
voicingNameResponse: preferencesDialogEmphasisSoundDesignDescriptionStringProperty
}
}
], {
Expand All @@ -62,19 +64,21 @@ export default class QuadrilateralSoundOptionsNode extends PreferencesPanelSecti
tandem: tandem.createTandem( 'soundDesignRadioButtonGroup' )
} );

const tracksPlayForeverLabel = new Text( preferencesDialogPlaySoundsForeverStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS );
const tracksPlayForeverCheckbox = new Checkbox( model.tracksPlayForeverProperty, tracksPlayForeverLabel, {
const tracksPlayForeverDescriptionText = new VoicingText( preferencesDialogSoundsPlayForeverDescriptionStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS );

const tracksPlayForeverLabelText = new Text( preferencesDialogSoundsPlayForeverLabelStringProperty, PreferencesDialog.PANEL_SECTION_CONTENT_OPTIONS );
const tracksPlayForeverCheckbox = new Checkbox( model.tracksPlayForeverProperty, tracksPlayForeverLabelText, {
tandem: tandem.createTandem( 'tracksPlayForeverCheckbox' ),

// voicing
voicingNameResponse: preferencesDialogPlaySoundsForeverStringProperty,
voicingNameResponse: preferencesDialogSoundsPlayForeverLabelStringProperty,
checkedContextResponse: tracksPlayForeverCheckedContextResponseStringProperty,
uncheckedContextResponse: tracksPlayForeverUncheckedContextResponseStringProperty
} );

super( {
contentNode: new Node( {
children: [ soundDesignLabelText, soundDesignDescriptionText, soundDesignRadioButtonGroup, tracksPlayForeverCheckbox ]
children: [ soundDesignLabelText, soundDesignDescriptionText, soundDesignRadioButtonGroup, tracksPlayForeverDescriptionText, tracksPlayForeverCheckbox ]
} ),

// The shape sound options should only be available when sounds are enabled. joist disables all audio
Expand All @@ -84,10 +88,10 @@ export default class QuadrilateralSoundOptionsNode extends PreferencesPanelSecti
} );

// layout
soundDesignDescriptionText.leftTop = soundDesignLabelText.leftBottom.plusXY( 0, 5 );
soundDesignRadioButtonGroup.leftTop = soundDesignDescriptionText.leftBottom.plusXY( PreferencesDialog.CONTENT_INDENTATION_SPACING, 5 );
tracksPlayForeverCheckbox.left = soundDesignLabelText.left;
tracksPlayForeverCheckbox.top = soundDesignRadioButtonGroup.bottom + PreferencesDialog.CONTENT_SPACING;
soundDesignDescriptionText.leftTop = soundDesignLabelText.leftBottom.plusXY( 0, PreferencesDialog.VERTICAL_CONTENT_SPACING );
soundDesignRadioButtonGroup.leftTop = soundDesignDescriptionText.leftBottom.plusXY( PreferencesDialog.CONTENT_INDENTATION_SPACING, PreferencesDialog.VERTICAL_CONTENT_SPACING );
tracksPlayForeverDescriptionText.leftTop = new Vector2( soundDesignLabelText.left, soundDesignRadioButtonGroup.bottom + PreferencesDialog.CONTENT_SPACING );
tracksPlayForeverCheckbox.leftTop = tracksPlayForeverDescriptionText.leftBottom.plusXY( PreferencesDialog.CONTENT_INDENTATION_SPACING, PreferencesDialog.VERTICAL_CONTENT_SPACING );

this.disposeQuadrilateralSoundOptionsNode = () => {
soundDesignRadioButtonGroup.dispose();
Expand Down
13 changes: 8 additions & 5 deletions quadrilateral-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@
"value": "Choose the sound design you hear as you create different shapes."
},
"preferencesDialog.layerSoundDesignDescription": {
"value": "Layered sounds emphasize shared shape qualities (default)"
"value": "Sounds layer to emphasize shared shape qualities"
},
"preferencesDialog.independentSoundDesignDescription": {
"value": "Sounds emphasize independent shapes"
"preferencesDialog.emphasisSoundDesignDescription": {
"value": "Unique sounds identify each shape"
},
"preferencesDialog.playSoundsForever": {
"value": "Play Shape Sounds forever when checked in sim."
"preferencesDialog.soundsPlayForeverDescription": {
"value": "Change how long shape sounds play when checked in sim."
},
"preferencesDialog.soundsPlayForeverLabel": {
"value": "Play shape sounds forever"
},
"smallSteps": {
"value": "Small Steps"
Expand Down

0 comments on commit 9ec50c3

Please sign in to comment.