How to disable ctrl + left click in viewer canvas

20 Views Asked by At

When user clicks into the viewer canvas while holding Ctrl key, the cursor changes to cross and allows for multi selection with a rectangle. How to disable this feature and disable LMB clicking while holding down Ctrl key completely?

I've tried putting the following override method into an Event Emmiter, but only the Shift key has been successfully disabled.

    public handleSingleClick(evt: MouseEvent, btn: number) {
        if ((evt.shiftKey || evt.ctrlKey) && btn === 0) {
            return true;
        }
        return false;
    }
1

There are 1 best solutions below

0
arkkuba On

Turns out the method in an Event Emitter should be as follows.

    public handleKeyDown(evt: KeyboardEvent, _keyCode: number) {
        if (evt.key === 'Control') {
            return true;
        }
        return false;
    }