MCPcopy Create free account
hub / github.com/codeaashu/claude-code / clampRect

Function clampRect

src/ink/layout/geometry.ts:71–82  ·  view source on GitHub ↗
(rect: Rectangle, size: Size)

Source from the content-addressed store, hash-verified

69}
70
71export function clampRect(rect: Rectangle, size: Size): Rectangle {
72 const minX = Math.max(0, rect.x)
73 const minY = Math.max(0, rect.y)
74 const maxX = Math.min(size.width - 1, rect.x + rect.width - 1)
75 const maxY = Math.min(size.height - 1, rect.y + rect.height - 1)
76 return {
77 x: minX,
78 y: minY,
79 width: Math.max(0, maxX - minX + 1),
80 height: Math.max(0, maxY - minY + 1),
81 }
82}
83
84export function withinBounds(size: Size, point: Point): boolean {
85 return (

Callers

nothing calls this directly

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected