(element: Element)
| 39 | } |
| 40 | |
| 41 | export function entityBounds(element: Element): IEntityBounds { |
| 42 | if (element instanceof SVGElement) { |
| 43 | return elementBBox(d3.select(element)); |
| 44 | } else if (element instanceof HTMLElement) { |
| 45 | const rect = element.getBoundingClientRect(); |
| 46 | return { x: rect.left, y: rect.top, width: rect.width, height: rect.height }; |
| 47 | } else { |
| 48 | return { x: 0, y: 0, width: 0, height: 0 }; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Screen refresh rate which is assumed to be 60fps |
no test coverage detected