Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 9x 9x 9x | import { ToolGroupManager } from '../../store';
import getActiveToolForKeyboardEvent from '../shared/getActiveToolForKeyboardEvent';
import { KeyDownEventType } from '../../types/EventTypes';
/**
* KeyDown event listener to handle viewport cursor icon changes
*
* @param evt - The KeyboardEvent
*/
export default function keyDown(evt: KeyDownEventType): void {
// get the active tool given the key and mouse button
const activeTool = getActiveToolForKeyboardEvent(evt);
Eif (!activeTool) {
return;
}
const { renderingEngineId, viewportId } = evt.detail;
const toolGroup = ToolGroupManager.getToolGroupForViewport(
viewportId,
renderingEngineId
);
const toolName = activeTool.getToolName();
if (Object.keys(toolGroup.toolOptions).includes(toolName)) {
toolGroup.setViewportsCursorByToolName(toolName);
}
}
|