"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Tools
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.FrameworkToolAdmin = void 0;
const ts_key_enum_1 = require("ts-key-enum");
const core_frontend_1 = require("@itwin/core-frontend");
const UiFramework_1 = require("../UiFramework");
/** Subclass of `ToolAdmin` in `@itwin/core-frontend` to be used to initialize `IModelApp`.
 *
 * Enable processing of shortcut keys registered to
 * [[UiFramework.keyboardShortcuts]] when focus is set to Home.
 *
 * ```ts
 * await IModelApp.startup({
 *   toolAdmin: new FrameworkToolAdmin()
 * });
 * ```
 * @beta
 */
class FrameworkToolAdmin extends core_frontend_1.ToolAdmin {
    /** Process shortcut key events */
    async processShortcutKey(e, wentDown) {
        let handled = false;
        if (wentDown && !UiFramework_1.UiFramework.isContextMenuOpen) {
            if (UiFramework_1.UiFramework.keyboardShortcuts.isFocusOnHome &&
                e.key !== ts_key_enum_1.Key.Escape.valueOf()) {
                UiFramework_1.UiFramework.keyboardShortcuts.processKey(e.key, e.altKey, e.ctrlKey, e.shiftKey);
                handled = true;
            }
        }
        return handled;
    }
}
exports.FrameworkToolAdmin = FrameworkToolAdmin;
//# sourceMappingURL=FrameworkToolAdmin.js.map