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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 466x 466x 466x 466x 466x 466x 514x 514x 514x 74x 514x 440x 440x 466x | import { ToolGroupManager } from '../../store'; import { ToolModes } from '../../enums'; import { EventTypes } from '../../types'; type ModesFilter = Array<ToolModes>; /** * Given the normalized mouse event and a filter of modes, * find all the tools on the element that are in one of the specified modes. * If the evtButton is specified, only tools with a matching binding will be returned. * @param evt - The normalized mouseDown event. * @param modesFilter - An array of entries from the `ToolModes` enum. */ export default function getToolsWithModesForMouseEvent( evt: EventTypes.MouseMoveEventType, modesFilter: ModesFilter, evtButton?: any ) { const { renderingEngineId, viewportId } = evt.detail; const toolGroup = ToolGroupManager.getToolGroupForViewport( viewportId, renderingEngineId ); Iif (!toolGroup) { return []; } const enabledTools = []; const toolGroupToolNames = Object.keys(toolGroup.toolOptions); for (let j = 0; j < toolGroupToolNames.length; j++) { const toolName = toolGroupToolNames[j]; const tool = toolGroup.toolOptions[toolName]; // tool has binding that matches the mouse button - we match those with // any modifier keys too since they can be passively interacted with const correctBinding = evtButton != null && // not null or undefined tool.bindings.length && tool.bindings.some((binding) => binding.mouseButton === evtButton); if ( modesFilter.includes(tool.mode) && // Should not filter by event's button // or should, and the tool binding includes the event's button (!evtButton || correctBinding) ) { const toolInstance = toolGroup.getToolInstance(toolName); enabledTools.push(toolInstance); } } return enabledTools; } |