MCPcopy Create free account
hub / github.com/editablejs/editable / resetElementRect

Function resetElementRect

packages/editor/src/utils/selection.ts:142–147  ·  view source on GitHub ↗
(rect: DOMRect, height: number)

Source from the content-addressed store, hash-verified

140 * @returns The reset DOMRect
141 */
142const resetElementRect = (rect: DOMRect, height: number) => {
143 const oldHeight = rect.height
144 if (oldHeight >= height) return rect
145 const top = rect.top + (oldHeight - height) / 2
146 return new DOMRect(rect.left, top, rect.width, height)
147}
148
149/**
150 * Check if a given DOMRect intersects with a given line defined by its top, bottom, and height values

Callers 1

matchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…