MCPcopy Index your code
hub / github.com/rough-stuff/rough-notation / svgRect

Method svgRect

src/rough-notation.ts:242–251  ·  view source on GitHub ↗
(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
254export function annotate(element: HTMLElement, config: RoughAnnotationConfig): RoughAnnotation {

Callers 1

rectsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected