@leafer/math
Advanced tools
+2
-2
| { | ||
| "name": "@leafer/math", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "@leafer/math", | ||
@@ -25,4 +25,4 @@ "author": "Chao (Leafer) Wan", | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.2" | ||
| "@leafer/interface": "1.0.3" | ||
| } | ||
| } |
@@ -26,5 +26,3 @@ import { IAround, IPointData, IBoundsData, IUnitPointData } from '@leafer/interface' | ||
| toPoint(around: IAround, bounds: IBoundsData, to?: IPointData, onlySize?: boolean, pointBounds?: IBoundsData) { | ||
| to || (to = {} as IPointData) | ||
| toPoint(around: IAround, bounds: IBoundsData, to: IPointData, onlySize?: boolean, pointBounds?: IBoundsData) { | ||
| const point = get(around) | ||
@@ -31,0 +29,0 @@ |
+10
-4
@@ -70,7 +70,13 @@ import { IPointData, IBoundsData, IMatrixData, IRangeSize, IScaleData, ISizeData } from '@leafer/interface' | ||
| scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height | ||
| } else if (scale) { | ||
| scaleData.scaleX = typeof scale === 'number' ? scale : scale.x | ||
| scaleData.scaleY = typeof scale === 'number' ? scale : scale.y | ||
| } else if (scale) MathHelper.assignScale(scaleData, scale) | ||
| return scaleData | ||
| }, | ||
| assignScale(scaleData: IScaleData, scale: number | IPointData): void { | ||
| if (typeof scale === 'number') { | ||
| scaleData.scaleX = scaleData.scaleY = scale | ||
| } else { | ||
| scaleData.scaleX = scale.x | ||
| scaleData.scaleY = scale.y | ||
| } | ||
| return scaleData | ||
| } | ||
@@ -77,0 +83,0 @@ |
+2
-1
@@ -172,3 +172,3 @@ 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'; | ||
| get: typeof get; | ||
| toPoint(around: IAround, bounds: IBoundsData, to?: IPointData, onlySize?: boolean, pointBounds?: IBoundsData): void; | ||
| toPoint(around: IAround, bounds: IBoundsData, to: IPointData, onlySize?: boolean, pointBounds?: IBoundsData): void; | ||
| }; | ||
@@ -243,2 +243,3 @@ declare function get(around: IAround): IUnitPointData; | ||
| getScaleData(scale: number | IPointData, size: number | ISizeData, originSize: ISizeData, scaleData?: IScaleData): IScaleData; | ||
| assignScale(scaleData: IScaleData, scale: number | IPointData): void; | ||
| }; | ||
@@ -245,0 +246,0 @@ declare const OneRadian: number; |
65264
0.3%1560
0.32%