import '../../../globals.js';
import optionize from '../../../phet-core/js/optionize.js';
import platform from '../../../phet-core/js/platform.js';
import { RichText } from '../../../scenery/js/imports.js';
import PhetFont from '../PhetFont.js';
import sceneryPhet from '../sceneryPhet.js';
import SceneryPhetStrings from '../SceneryPhetStrings.js';
import KeyNode from './KeyNode.js';
export default class TextKeyNode extends KeyNode {
    constructor(string, providedOptions) {
        // margins, width, and height in ScreenView coordinates
        const options = optionize()({
            // text options
            font: new PhetFont({ size: 16 }),
            fill: 'black',
            textMaxWidth: 55, // Long keys like Space, Enter, Tab, Shift are all smaller than this.
            // by default, key should tightly surround the text, with a bit more horizontal space
            xPadding: 11
        }, providedOptions);
        // use RichText because some keys (like page up/page down/caps lock) might span multiple lines
        const text = new RichText(string, {
            font: options.font,
            fill: options.fill,
            maxWidth: options.textMaxWidth
        });
        super(text, options);
        this.addDisposable(text);
    }
    /**
     * Returns the correct platform dependent key string for "Alt". "Alt" on Windows, "Option" on Mac.
     */
    static getAltKeyString() {
        return platform.mac ?
            SceneryPhetStrings.key.optionStringProperty :
            SceneryPhetStrings.key.altStringProperty;
    }
    //-------------------------------------------------------------------------------------------------
    // Static factory methods for specific text strings. For brevity, these methods have the same names
    // as their string keys. For example SceneryPhetStrings.key.esc is rendered by the esc method.
    //-------------------------------------------------------------------------------------------------
    // Note that this will render "Alt" OR "Options", depending on platform. If there is a description of this icon
    // in the PDOM please use getAltKeyString().
    static altOrOption(providedOptions) {
        return new TextKeyNode(TextKeyNode.getAltKeyString(), providedOptions);
    }
    static capsLock(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.capsLockStringProperty, providedOptions);
    }
    static esc(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.escStringProperty, providedOptions);
    }
    static end(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.endStringProperty, providedOptions);
    }
    static enter(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.enterStringProperty, providedOptions);
    }
    static fn(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.fnStringProperty, providedOptions);
    }
    static home(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.homeStringProperty, providedOptions);
    }
    static pageDown(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.pageDownStringProperty, providedOptions);
    }
    static pageUp(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.pageUpStringProperty, providedOptions);
    }
    static space(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.spaceStringProperty, providedOptions);
    }
    static shift(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.shiftStringProperty, providedOptions);
    }
    static tab(providedOptions) {
        return new TextKeyNode(SceneryPhetStrings.key.tabStringProperty, providedOptions);
    }
}
sceneryPhet.register('TextKeyNode', TextKeyNode);
//# sourceMappingURL=TextKeyNode.js.map