Method
svgRect
(svg: SVGSVGElement, bounds: DOMRect | DOMRectReadOnly)
Source from the content-addressed store, hash-verified
| 240 | } |
| 241 | |
| 242 | private svgRect(svg: SVGSVGElement, bounds: DOMRect | DOMRectReadOnly): Rect { |
| 243 | const rect1 = svg.getBoundingClientRect(); |
| 244 | const rect2 = bounds; |
| 245 | return { |
| 246 | x: (rect2.x || rect2.left) - (rect1.x || rect1.left), |
| 247 | y: (rect2.y || rect2.top) - (rect1.y || rect1.top), |
| 248 | w: rect2.width, |
| 249 | h: rect2.height |
| 250 | }; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | export function annotate(element: HTMLElement, config: RoughAnnotationConfig): RoughAnnotation { |
Tested by
no test coverage detected