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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x | import type { Types } from '@cornerstonejs/core'; import { SVGDrawingHelper } from '../types'; import _getHash from './_getHash'; import setAttributesIfNecessary from './setAttributesIfNecessary'; import setNewAttributesIfValid from './setNewAttributesIfValid'; function drawCircle( svgDrawingHelper: SVGDrawingHelper, annotationUID: string, circleUID: string, center: Types.Point2, radius: number, options = {}, dataId = '' ): void { const { color, fill, width, lineWidth, lineDash, fillOpacity, strokeOpacity, } = Object.assign( { color: 'rgb(0, 255, 0)', fill: 'transparent', width: '2', lineDash: undefined, lineWidth: undefined, strokeOpacity: 1, fillOpacity: 1, }, options ); // for supporting both lineWidth and width options const strokeWidth = lineWidth || width; // variable for the namespace const svgns = 'http://www.w3.org/2000/svg'; const svgNodeHash = _getHash(annotationUID, 'circle', circleUID); const existingCircleElement = svgDrawingHelper.getSvgNode(svgNodeHash); const attributes = { cx: `${center[0]}`, cy: `${center[1]}`, r: `${radius}`, stroke: color, fill, 'stroke-width': strokeWidth, 'stroke-dasharray': lineDash, 'fill-opacity': fillOpacity, // setting fill opacity 'stroke-opacity': strokeOpacity, // setting stroke opacity }; Iif (existingCircleElement) { setAttributesIfNecessary(attributes, existingCircleElement); svgDrawingHelper.setNodeTouched(svgNodeHash); } else { const newCircleElement = document.createElementNS(svgns, 'circle'); Eif (dataId !== '') { newCircleElement.setAttribute('data-id', dataId); } setNewAttributesIfValid(attributes, newCircleElement); svgDrawingHelper.appendNode(newCircleElement, svgNodeHash); } } export default drawCircle; |