Skip to content

Commit

Permalink
sim specific keyboard help sections support Voicing, see #249
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Jan 7, 2023
1 parent fe5a582 commit 8d01391
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
10 changes: 10 additions & 0 deletions js/QuadrilateralStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ type StringsType = {
'unlockedContextResponse': string;
'unlockedContextResponseStringProperty': LinkableProperty<string>;
}
};
'keyboardHelpDialog': {
'checkShapeDescription': string;
'checkShapeDescriptionStringProperty': LinkableProperty<string>;
'resetShapeDescription': string;
'resetShapeDescriptionStringProperty': LinkableProperty<string>;
'moveShapeDescription': string;
'moveShapeDescriptionStringProperty': LinkableProperty<string>;
'smallerStepsDescription': string;
'smallerStepsDescriptionStringProperty': LinkableProperty<string>;
}
}
};
Expand Down
12 changes: 10 additions & 2 deletions js/quadrilateral/view/MoveShapeHelpSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ import QuadrilateralStrings from '../../QuadrilateralStrings.js';
import { Text } from '../../../../scenery/js/imports.js';
import QuadrilateralKeyboardHelpContent from './QuadrilateralKeyboardHelpContent.js';

// constants
const moveShapeDescriptionString = QuadrilateralStrings.a11y.keyboardHelpDialog.moveShapeDescription;
const smallerStepsDescriptionString = QuadrilateralStrings.a11y.keyboardHelpDialog.smallerStepsDescription;

class MoveShapeHelpSection extends KeyboardHelpSection {
public constructor() {

// basic movement
const basicMovementRow = KeyboardHelpSectionRow.labelWithIcon(
QuadrilateralStrings.keyboardHelpDialog.moveASideOrCorner,
KeyboardHelpIconFactory.arrowOrWasdKeysRowIcon()
KeyboardHelpIconFactory.arrowOrWasdKeysRowIcon(),
{
labelInnerContent: moveShapeDescriptionString
}
);

// fine-grained movement
Expand All @@ -36,7 +43,8 @@ class MoveShapeHelpSection extends KeyboardHelpSection {
], {
labelOptions: {
lineWrap: QuadrilateralKeyboardHelpContent.LABEL_LINE_WRAP
}
},
labelInnerContent: smallerStepsDescriptionString
}
);

Expand Down
13 changes: 10 additions & 3 deletions js/quadrilateral/view/ShapeShortcutsHelpSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import quadrilateral from '../../quadrilateral.js';
import QuadrilateralStrings from '../../QuadrilateralStrings.js';
import QuadrilateralKeyboardHelpContent from './QuadrilateralKeyboardHelpContent.js';

// Voicing is NOT translatable and will never be
// Voicing is NOT translatable and will never be. This content is invisible in non-english locales and when Voicing
// is not supported.
const checkShapeWithVoicingString = 'With Voicing enabled Check Current Shape';
const checkShapeDescriptionString = QuadrilateralStrings.a11y.keyboardHelpDialog.checkShapeDescription;
const resetShapeDescriptionString = QuadrilateralStrings.a11y.keyboardHelpDialog.resetShapeDescription;

class ShapeShortcutsHelpSection extends KeyboardHelpSection {
public constructor() {
Expand All @@ -29,7 +32,8 @@ class ShapeShortcutsHelpSection extends KeyboardHelpSection {
KeyboardHelpIconFactory.altPlusIcon( new LetterKeyNode( 'C' ) ), {
labelOptions: {
lineWrap: QuadrilateralKeyboardHelpContent.LABEL_LINE_WRAP
}
},
labelInnerContent: checkShapeDescriptionString
}
);

Expand All @@ -42,7 +46,10 @@ class ShapeShortcutsHelpSection extends KeyboardHelpSection {
TextKeyNode.shift(),
new LetterKeyNode( 'R' )
]
)
),
{
labelInnerContent: resetShapeDescriptionString
}
);

const contents = [];
Expand Down
14 changes: 14 additions & 0 deletions quadrilateral-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,20 @@
"value": "Shift key needed to make small steps."
}
}
},
"keyboardHelpDialog": {
"checkShapeDescription": {
"value": "With Voicing enabled Check Current Shape with ALT plus C."
},
"resetShapeDescription": {
"value": "Reset Shape with ALT plus Shift plus R."
},
"moveShapeDescription": {
"value": "Move a corner or side up, left, down, or right with Arrow keys or with letter keys W, A, S, or D."
},
"smallerStepsDescription": {
"value": "To move in smaller steps add Shift key to movement keys or mouse."
}
}
}
}
1 change: 0 additions & 1 deletion quadrilateral_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"runnable": true,
"supportedBrands": [
"phet",
"phet-io",
"adapted-from-phet"
],
"phetLibs": [
Expand Down

0 comments on commit 8d01391

Please sign in to comment.