You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@leafer/helper

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer/helper - npm Package Compare versions

Comparing version
1.2.1
to
1.2.2
+3
-3
package.json
{
"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"
}
}
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 @@