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 | import { setElementCursor } from './elementCursor';
import MouseCursor from './MouseCursor';
import SVGMouseCursor from './SVGMouseCursor';
/**
* Set the cursor for an HTML element. cursorNames can be either
* cornerstone3DTools cursors or standard cursors.
*
* @param element - The element to set the cursor on.
* @param cursorName - The name of the cursor to set. This can be
* any cursor name either Cornerstone-specific cursor names or the standard
* CSS cursor names.
*/
function setCursorForElement(
element: HTMLDivElement,
cursorName: string
): void {
let cursor = SVGMouseCursor.getDefinedCursor(cursorName, true);
if (!cursor) {
cursor = MouseCursor.getDefinedCursor(cursorName);
}
if (!cursor) {
console.log(
`Cursor ${cursorName} is not defined either as SVG or as a standard cursor.`
);
cursor = MouseCursor.getDefinedCursor(cursorName);
}
setElementCursor(element, cursor);
}
export default setCursorForElement;
|