Skip to content

Commit

Permalink
convert SliderControlsAndBasicActionsKeyboardHelpContent to TS, #769
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 30, 2022
1 parent e68ce1b commit c9f1765
Showing 1 changed file with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2019-2022, University of Colorado Boulder

// @ts-nocheck
/**
* Content for a KeyboardHelpDialog that contains a BasicActionsKeyboardHelpSection and a SliderControlsKeyboardHelpSection.
* Often sim interaction only involves sliders and basic tab and button interaction. For those sims, this
Expand All @@ -9,30 +8,34 @@
* @author Jesse Greenberg
*/

import merge from '../../../../phet-core/js/merge.js';
import optionize from '../../../../phet-core/js/optionize.js';
import StrictOmit from '../../../../phet-core/js/types/StrictOmit.js';
import sceneryPhet from '../../sceneryPhet.js';
import BasicActionsKeyboardHelpSection from './BasicActionsKeyboardHelpSection.js';
import SliderControlsKeyboardHelpSection from './SliderControlsKeyboardHelpSection.js';
import TwoColumnKeyboardHelpContent from './TwoColumnKeyboardHelpContent.js';
import BasicActionsKeyboardHelpSection, { BasicActionsKeyboardHelpSectionOptions } from './BasicActionsKeyboardHelpSection.js';
import SliderControlsKeyboardHelpSection, { SliderControlsKeyboardHelpSectionOptions } from './SliderControlsKeyboardHelpSection.js';
import TwoColumnKeyboardHelpContent, { TwoColumnKeyboardHelpContentOptions } from './TwoColumnKeyboardHelpContent.js';

class SliderControlsAndBasicActionsKeyboardHelpContent extends TwoColumnKeyboardHelpContent {
type SelfOptions = {

/**
* @param {Object} [options]
*/
constructor( options ) {
// options passed to the SliderControlsKeyboardHelpSection
sliderSectionOptions?: SliderControlsKeyboardHelpSectionOptions;

options = merge( {
// options passed to the BasicActionsKeyboardHelpSection
generalSectionOptions?: BasicActionsKeyboardHelpSectionOptions;
};

// {null|*} - options passed to the SliderControlsKeyboardHelpSection
sliderSectionOptions: null,
export type SliderControlsAndBasicActionsKeyboardHelpContentOptions = SelfOptions & TwoColumnKeyboardHelpContentOptions;

// {null|*} - options passed to the BasicActionsKeyboardHelpSection
generalSectionOptions: null,
export default class SliderControlsAndBasicActionsKeyboardHelpContent extends TwoColumnKeyboardHelpContent {

// i18n, a bit shorter than default so general and slider sections fits side by side
textMaxWidth: 160
}, options );
public constructor( providedOptions?: SliderControlsAndBasicActionsKeyboardHelpContentOptions ) {

const options = optionize<SliderControlsAndBasicActionsKeyboardHelpContentOptions,
StrictOmit<SelfOptions, 'sliderSectionOptions' | 'generalSectionOptions'>,
TwoColumnKeyboardHelpContentOptions>()( {
//TODO https://github.com/phetsims/scenery-phet/issues/769 no such option, is this vestigial?
// textMaxWidth: 160 // a bit narrower than default, so the sections fit side-by-side
}, providedOptions );

const sliderHelpSection = new SliderControlsKeyboardHelpSection( options.sliderSectionOptions );
const basicActionsHelpSection = new BasicActionsKeyboardHelpSection( options.generalSectionOptions );
Expand All @@ -41,5 +44,4 @@ class SliderControlsAndBasicActionsKeyboardHelpContent extends TwoColumnKeyboard
}
}

sceneryPhet.register( 'SliderControlsAndBasicActionsKeyboardHelpContent', SliderControlsAndBasicActionsKeyboardHelpContent );
export default SliderControlsAndBasicActionsKeyboardHelpContent;
sceneryPhet.register( 'SliderControlsAndBasicActionsKeyboardHelpContent', SliderControlsAndBasicActionsKeyboardHelpContent );

0 comments on commit c9f1765

Please sign in to comment.