private onKeyDown()

in src/canvastools/ts/CanvasTools/Selection/Selectors/RectSelector.ts [314:342]


    private onKeyDown(e: KeyboardEvent) {
        // Holding shift key enable square drawing mode
        if (e.shiftKey) {
            this.selectionModificator = SelectionModificator.SQUARE;
        }

        if (e.ctrlKey && !this.capturingState) {
            this.isTwoPoints = true;
        }

        if (e.key === "k" || e.key.toLocaleUpperCase() === "K") {
            if (!this.usingKeyboardCursor) {
                // start keyboard mode
                this.activateKeyboardCursor();
            } else if (this.usingKeyboardCursor && !this.capturingState) {
                // set crossA
                this.startTwoPointSelection(this.curKeyboardCross);
                this.curKeyboardCross = this.crossB;
            } else if (this.usingKeyboardCursor && this.capturingState) {
                // set crossB
                this.endTwoPointSelection(this.curKeyboardCross);
                this.curKeyboardCross = this.crossA;
            }
        }
        if (!e.ctrlKey && e.shiftKey && this.isKeyboardControlKey(e.key) && this.usingKeyboardCursor) {
            e.preventDefault();
            this.moveKeyboardCursor(e.key);
        }
    }