Skip to content

Commit

Permalink
convert TwoColumnKeyboardHelpContent to .ts, use TwoColumnKeyboardHel…
Browse files Browse the repository at this point in the history
…pContentOptions in RAP, #404
  • Loading branch information
pixelzoom committed Jul 22, 2022
1 parent f85f93e commit 5d2dfe9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 8 additions & 4 deletions js/common/view/RAPKeyboardHelpContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ import BasicActionsKeyboardHelpSection from '../../../../scenery-phet/js/keyboar
import KeyboardHelpIconFactory from '../../../../scenery-phet/js/keyboard/help/KeyboardHelpIconFactory.js';
import KeyboardHelpSection from '../../../../scenery-phet/js/keyboard/help/KeyboardHelpSection.js';
import SliderControlsKeyboardHelpSection from '../../../../scenery-phet/js/keyboard/help/SliderControlsKeyboardHelpSection.js';
import TwoColumnKeyboardHelpContent from '../../../../scenery-phet/js/keyboard/help/TwoColumnKeyboardHelpContent.js';
import TwoColumnKeyboardHelpContent, { TwoColumnKeyboardHelpContentOptions } from '../../../../scenery-phet/js/keyboard/help/TwoColumnKeyboardHelpContent.js';
import LetterKeyNode from '../../../../scenery-phet/js/keyboard/LetterKeyNode.js';
import NumberKeyNode from '../../../../scenery-phet/js/keyboard/NumberKeyNode.js';
import TextKeyNode from '../../../../scenery-phet/js/keyboard/TextKeyNode.js';
import ratioAndProportion from '../../ratioAndProportion.js';
import ratioAndProportionStrings from '../../ratioAndProportionStrings.js';
import { NodeOptions } from '../../../../scenery/js/imports.js';
import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';

type SelfOptions = EmptySelfOptions;
export type RAPKeyboardHelpContentOptions = SelfOptions & TwoColumnKeyboardHelpContentOptions;

class RAPKeyboardHelpContent extends TwoColumnKeyboardHelpContent {

/**
* @param challengeHelpSection - keyboard help section for determining how to change the target ratio
* @param [options] - TODO: use TwoColumnKeyboardHelpContentOptions when available, https://github.com/phetsims/ratio-and-proportion/issues/404
* @param [providedOptions]
*/
public constructor( challengeHelpSection: KeyboardHelpSection, options?: NodeOptions ) {
public constructor( challengeHelpSection: KeyboardHelpSection, providedOptions?: RAPKeyboardHelpContentOptions ) {

const moveLeftOrRightHandHelpSection = new SliderControlsKeyboardHelpSection( {
headingString: ratioAndProportionStrings.moveHandsIndividually,
Expand All @@ -42,7 +46,7 @@ class RAPKeyboardHelpContent extends TwoColumnKeyboardHelpContent {
const leftContent = [ moveLeftOrRightHandHelpSection, new BothHandsHelpSection() ];
const rightContent = [ challengeHelpSection, basicActionsHelpSection ];

super( leftContent, rightContent, options );
super( leftContent, rightContent, providedOptions );
}
}

Expand Down
10 changes: 6 additions & 4 deletions js/create/view/CreateScreenKeyboardHelpContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import KeyboardHelpIconFactory from '../../../../scenery-phet/js/keyboard/help/KeyboardHelpIconFactory.js';
import KeyboardHelpSection from '../../../../scenery-phet/js/keyboard/help/KeyboardHelpSection.js';
import TextKeyNode from '../../../../scenery-phet/js/keyboard/TextKeyNode.js';
import RAPKeyboardHelpContent from '../../common/view/RAPKeyboardHelpContent.js';
import RAPKeyboardHelpContent, { RAPKeyboardHelpContentOptions } from '../../common/view/RAPKeyboardHelpContent.js';
import ratioAndProportion from '../../ratioAndProportion.js';
import ratioAndProportionStrings from '../../ratioAndProportionStrings.js';
import { NodeOptions } from '../../../../scenery/js/imports.js';
import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';

type SelfOptions = EmptySelfOptions;
type CreateScreenKeyboardHelpContentOptions = SelfOptions & RAPKeyboardHelpContentOptions;

class CreateScreenKeyboardHelpContent extends RAPKeyboardHelpContent {
public constructor() {
Expand All @@ -22,8 +25,7 @@ class CreateScreenKeyboardHelpContent extends RAPKeyboardHelpContent {

class MyChallengeHelpSection extends KeyboardHelpSection {

// TODO: use KeyboardHelpSectionOptions when possible, https://github.com/phetsims/ratio-and-proportion/issues/404
public constructor( options?: NodeOptions ) {
public constructor( options?: CreateScreenKeyboardHelpContentOptions ) {

const setHandRatioValue = KeyboardHelpSection.labelWithIcon( ratioAndProportionStrings.setHandRatioValue,
KeyboardHelpIconFactory.upDownArrowKeysRowIcon(), {
Expand Down

0 comments on commit 5d2dfe9

Please sign in to comment.