"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyboardToClearSelection = void 0;
const core_1 = require("@vived/core");
const KeyboardInput_1 = require("../../KeyboardInput/Entities/KeyboardInput");
const Entities_1 = require("../Entities");
class KeyboardToClearSelection extends core_1.AppObjectController {
    get selection() {
        return this.getCachedSingleton(Entities_1.Selection.type);
    }
    constructor(appObject) {
        super(appObject, KeyboardToClearSelection.type);
        this.onKeyDown = (e) => {
            if (e.code === "Escape" && this.selection) {
                this.selection.selectedObjectId = null;
            }
        };
        const keyboardInput = KeyboardInput_1.KeyboardInputEntity.get(this.appObjects);
        keyboardInput?.registerController(this);
    }
}
exports.KeyboardToClearSelection = KeyboardToClearSelection;
KeyboardToClearSelection.type = "KeyboardToClearSelection";
//# sourceMappingURL=KeyboardToClearSelection.js.map