lilishop-uniapp/js_sdk/u-draw-poster/utils/object-sizing.d.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-05-13 11:03:32 +08:00
export declare type ObjectFit = "contain" | "cover";
export declare type ObjectPosition = ["left" | "center" | "right", "top" | "center" | "bottom"];
export interface Size {
width: number;
height: number;
}
/**
*
* @see https://drafts.csswg.org/css-images-3/#sizing-terms
*
* ##
* ### intrinsic dimensions
*
*
* ### specified size
*
*
* ### concrete object size
* `objectFit`
*
* ### default object size
*/
export declare function calculateConcreteRect(style: {
/** @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-fit */
objectFit?: ObjectFit;
/** @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-position */
intrinsicPosition?: ObjectPosition;
specifiedPosition?: [number, number];
}, intrinsicSize: Size, specifiedSize: Size): {
sx: number;
sy: number;
sw: number;
sh: number;
dx: number;
dy: number;
dw: number;
dh: number;
};