@leafer/helper
Advanced tools
+3
-3
| { | ||
| "name": "@leafer/helper", | ||
| "version": "1.2.1", | ||
| "version": "1.2.2", | ||
| "description": "@leafer/helper", | ||
@@ -25,7 +25,7 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.2.1" | ||
| "@leafer/math": "1.2.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.2.1" | ||
| "@leafer/interface": "1.2.2" | ||
| } | ||
| } |
+15
-10
| import { IAlign, ILeaf, IMatrixData, IPointData, IAxis } from '@leafer/interface' | ||
| import { MathHelper, MatrixHelper, PointHelper, AroundHelper, getMatrixData } from '@leafer/math' | ||
| import { MathHelper, MatrixHelper, PointHelper, AroundHelper, getMatrixData, BoundsHelper } from '@leafer/math' | ||
@@ -146,13 +146,18 @@ | ||
| setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean): void { | ||
| const layout = getLayout(transform, t.origin && L.getInnerOrigin(t, t.origin), t.around && L.getInnerOrigin(t, t.around)) | ||
| const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin) | ||
| const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around)) | ||
| if (resize) { | ||
| const scaleX = layout.scaleX / t.scaleX | ||
| const scaleY = layout.scaleY / t.scaleY | ||
| delete layout.scaleX | ||
| delete layout.scaleY | ||
| const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY | ||
| delete layout.scaleX, delete layout.scaleY | ||
| if (originPoint) { // fix origin: resize 方式下 boxBounds 会变化,导致 originPoint 不准确,需偏移至正确的位置 | ||
| BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY)) | ||
| const changedPoint = L.getInnerOrigin(t, data.origin) | ||
| PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y) | ||
| } | ||
| t.set(layout) | ||
| t.scaleResize(scaleX, scaleY, resize !== true) | ||
| } else { | ||
| t.set(layout) | ||
| } | ||
| t.scaleResize(scaleX, scaleY, false) | ||
| } else t.set(layout) | ||
| }, | ||
@@ -159,0 +164,0 @@ |
17153
2.61%333
0.6%+ Added
- Removed
Updated