first commit
This commit is contained in:
23
claude-code源码-中文注释/src/ink/measure-element.ts
Normal file
23
claude-code源码-中文注释/src/ink/measure-element.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { DOMElement } from './dom.js'
|
||||
|
||||
type Output = {
|
||||
/**
|
||||
* 元素宽度。
|
||||
*/
|
||||
width: number
|
||||
|
||||
/**
|
||||
* 元素高度。
|
||||
*/
|
||||
height: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 测量特定 `<Box>` 元素的尺寸。
|
||||
*/
|
||||
const measureElement = (node: DOMElement): Output => ({
|
||||
width: node.yogaNode?.getComputedWidth() ?? 0,
|
||||
height: node.yogaNode?.getComputedHeight() ?? 0,
|
||||
})
|
||||
|
||||
export default measureElement
|
||||
Reference in New Issue
Block a user