Function: withRect()
withRect(
r,patch):Rect
Defined in: geometry/types.ts:114
派生字段安全的矩形替换:改单边后重算 width/height。
Rect 的 width/height 是由四边推导的冗余字段,{ ...r, xmax: ... } 这类
spread 直改会让派生字段失真——凡改边一律走本函数(坐标校验委托 rect)。
Parameters
r
原矩形
patch
Partial<Pick<Rect, "xmin" | "ymin" | "xmax" | "ymax">>
要替换的边(未提供的边保持原值)
Returns
派生字段已重算的新矩形