@leafer/math
Advanced tools
+2
-2
| { | ||
| "name": "@leafer/math", | ||
| "version": "1.5.1", | ||
| "version": "1.5.2", | ||
| "description": "@leafer/math", | ||
@@ -25,4 +25,4 @@ "author": "Chao (Leafer) Wan", | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.5.1" | ||
| "@leafer/interface": "1.5.2" | ||
| } | ||
| } |
@@ -7,5 +7,5 @@ import { IPointData, IBoundsData, IAlign } from '@leafer/interface' | ||
| export const AlignHelper = { | ||
| toPoint(align: IAlign, contentBounds: IBoundsData, bounds: IBoundsData, to?: IPointData, onlySize?: boolean): void { | ||
| toPoint(align: IAlign, contentBounds: IBoundsData, bounds: IBoundsData, to: IPointData, onlySize?: boolean): void { | ||
| toPoint(align, bounds, to, onlySize, contentBounds) | ||
| } | ||
| } |
@@ -1,2 +0,2 @@ | ||
| import { IPointData, IBoundsData, IMatrixData, IRangeSize, IScaleData, ISizeData } from '@leafer/interface' | ||
| import { IPointData, IBoundsData, IMatrixData, IRangeSize, IScaleData, ISizeData, IOptionSizeData } from '@leafer/interface' | ||
@@ -65,7 +65,8 @@ const { round, pow, PI } = Math | ||
| getScaleData(scale: number | IPointData, size: number | ISizeData, originSize: ISizeData, scaleData?: IScaleData): IScaleData { | ||
| getScaleData(scale: number | IPointData, size: number | IOptionSizeData, originSize: ISizeData, scaleData?: IScaleData): IScaleData { | ||
| if (!scaleData) scaleData = {} as IScaleData | ||
| if (size) { | ||
| scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width | ||
| scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height | ||
| const scaleX = (typeof size === 'number' ? size : size.width || 0) / originSize.width, scaleY = (typeof size === 'number' ? size : size.height || 0) / originSize.height | ||
| scaleData.scaleX = scaleX || scaleY || 1 | ||
| scaleData.scaleY = scaleY || scaleX || 1 | ||
| } else if (scale) MathHelper.assignScale(scaleData, scale) | ||
@@ -72,0 +73,0 @@ return scaleData |
+3
-3
@@ -1,2 +0,2 @@ | ||
| import { INumberMap, IPoint, IPointData, IMatrixData, IBounds, IBoundsData, IMatrix, IFourNumber, ISide, IObject, IBoundsDataFn, IRadiusPointData, IMatrixWithLayoutData, IAutoBounds, IAutoBoundsData, ISizeData, IMatrixWithScaleData, ILayoutData, IUnitPointData, IAround, IAlign, IOffsetBoundsData, ITwoPointBoundsData, IRangeSize, IScaleData, IMatrixWithOptionScaleData, IScrollPointData } from '@leafer/interface'; | ||
| import { INumberMap, IPoint, IPointData, IMatrixData, IBounds, IBoundsData, IMatrix, IFourNumber, ISide, IObject, IBoundsDataFn, IRadiusPointData, IMatrixWithLayoutData, IAutoBounds, IAutoBoundsData, ISizeData, IMatrixWithScaleData, ILayoutData, IUnitPointData, IAround, IAlign, IOffsetBoundsData, ITwoPointBoundsData, IRangeSize, IOptionSizeData, IScaleData, IMatrixWithOptionScaleData, IScrollPointData } from '@leafer/interface'; | ||
@@ -178,3 +178,3 @@ declare const IncrementId: { | ||
| declare const AlignHelper: { | ||
| toPoint(align: IAlign, contentBounds: IBoundsData, bounds: IBoundsData, to?: IPointData, onlySize?: boolean): void; | ||
| toPoint(align: IAlign, contentBounds: IBoundsData, bounds: IBoundsData, to: IPointData, onlySize?: boolean): void; | ||
| }; | ||
@@ -243,3 +243,3 @@ | ||
| float(num: number, maxLength?: number): number; | ||
| getScaleData(scale: number | IPointData, size: number | ISizeData, originSize: ISizeData, scaleData?: IScaleData): IScaleData; | ||
| getScaleData(scale: number | IPointData, size: number | IOptionSizeData, originSize: ISizeData, scaleData?: IScaleData): IScaleData; | ||
| assignScale(scaleData: IScaleData, scale: number | IPointData): void; | ||
@@ -246,0 +246,0 @@ }; |
65757
0.21%1567
0.06%