mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
27 lines
532 B
TypeScript
27 lines
532 B
TypeScript
|
|
/**
|
|
* @category core/math
|
|
*/
|
|
|
|
export interface IRect2D {
|
|
x?: number;
|
|
y?: number;
|
|
width?: number;
|
|
height?: number;
|
|
}
|
|
|
|
export interface INormalizedRect2D {
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
}
|
|
|
|
export function normalizeRect2D (rect: IRect2D, fullWidth: number, fullHeight: number): INormalizedRect2D {
|
|
rect.x = rect.x || 0;
|
|
rect.y = rect.y || 0;
|
|
rect.width = rect.width || fullWidth;
|
|
rect.height = rect.height || fullHeight;
|
|
return rect as INormalizedRect2D;
|
|
}
|