MCPcopy Create free account
hub / github.com/DTStack/molecule / getElementClientCenter

Function getElementClientCenter

src/common/dom.ts:152–158  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

150 * @returns
151 */
152export function getElementClientCenter(element: HTMLElement) {
153 const { left, top, width, height } = element.getBoundingClientRect();
154 return {
155 x: left + width / 2,
156 y: top + height / 2,
157 };
158}
159
160/**
161 * Get the data-* attributions from props

Callers 2

dragFunction · 0.90
dom.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected