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

@leafer/math

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer/math - npm Package Compare versions

Comparing version
1.0.0-beta.4
to
1.0.0-beta.5
+2
-2
package.json
{
"name": "@leafer/math",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"description": "@leafer/math",

@@ -22,4 +22,4 @@ "author": "Chao (Leafer) Wan",

"devDependencies": {
"@leafer/interface": "1.0.0-beta.4"
"@leafer/interface": "1.0.0-beta.5"
}
}

@@ -97,7 +97,19 @@ import { IPointData, IBoundsData, IMatrixData, IBoundsDataHandle, IObject, IMatrix, IOffsetBoundsData, IRadiusPointData } from '@leafer/interface'

to.x = matrix.e + t.x * matrix.a
to.y = matrix.f + t.y * matrix.d
to.width = t.width * matrix.a
to.height = t.height * matrix.d
const { a, d } = matrix
if (a > 0) {
to.width = t.width * a
to.x = matrix.e + t.x * a
} else {
to.width = t.width * -a
to.x = matrix.e + t.x * a - to.width
}
if (d > 0) {
to.height = t.height * d
to.y = matrix.f + t.y * d
} else {
to.height = t.height * -d
to.y = matrix.f + t.y * d - to.height
}
} else {

@@ -104,0 +116,0 @@

@@ -47,8 +47,8 @@ import { IMatrix, IMatrixData, IPointData, IMatrixDecompositionData } from '@leafer/interface'

public scaleOf(center: IPointData, x: number, y?: number): IMatrix {
M.scaleOf(this, center, x, y)
public scaleOfOuter(origin: IPointData, x: number, y?: number): IMatrix {
M.scaleOfOuter(this, origin, x, y)
return this
}
public scaleOfInner(center: IPointData, x: number, y?: number): IMatrix {
M.scaleOfInner(this, center, x, y)
public scaleOfInner(origin: IPointData, x: number, y?: number): IMatrix {
M.scaleOfInner(this, origin, x, y)
return this

@@ -62,9 +62,9 @@ }

public rotateOf(center: IPointData, angle: number): IMatrix {
M.rotateOf(this, center, angle)
public rotateOfOuter(origin: IPointData, angle: number): IMatrix {
M.rotateOfOuter(this, origin, angle)
return this
}
public rotateOfInner(center: IPointData, angle: number): IMatrix {
M.rotateOfInner(this, center, angle)
public rotateOfInner(origin: IPointData, angle: number): IMatrix {
M.rotateOfInner(this, origin, angle)
return this

@@ -79,9 +79,9 @@ }

public skewOf(center: IPointData, x: number, y?: number): IMatrix {
M.skewOf(this, center, x, y)
public skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix {
M.skewOfOuter(this, origin, x, y)
return this
}
public skewOfInner(center: IPointData, x: number, y?: number): IMatrix {
M.skewOfInner(this, center, x, y)
public skewOfInner(origin: IPointData, x: number, y?: number): IMatrix {
M.skewOfInner(this, origin, x, y)
return this

@@ -88,0 +88,0 @@ }

@@ -57,11 +57,11 @@ import { IMatrix, IMatrixData, IPointData, IMatrixDecompositionData } from '@leafer/interface'

scaleOf(t: IMatrixData, center: IPointData, x: number, y: number = x): void {
M.toInnerPoint(t, center, tempPoint)
scaleOfOuter(t: IMatrixData, origin: IPointData, x: number, y: number = x): void {
M.toInnerPoint(t, origin, tempPoint)
M.scaleOfInner(t, tempPoint, x, y)
},
scaleOfInner(t: IMatrixData, center: IPointData, x: number, y: number = x): void {
M.translateInner(t, center.x, center.y)
scaleOfInner(t: IMatrixData, origin: IPointData, x: number, y: number = x): void {
M.translateInner(t, origin.x, origin.y)
M.scale(t, x, y)
M.translateInner(t, -center.x, -center.y)
M.translateInner(t, -origin.x, -origin.y)
},

@@ -82,11 +82,11 @@

rotateOf(t: IMatrixData, center: IPointData, angle: number): void {
M.toInnerPoint(t, center, tempPoint)
rotateOfOuter(t: IMatrixData, origin: IPointData, angle: number): void {
M.toInnerPoint(t, origin, tempPoint)
M.rotateOfInner(t, tempPoint, angle)
},
rotateOfInner(t: IMatrixData, center: IPointData, angle: number): void {
M.translateInner(t, center.x, center.y)
rotateOfInner(t: IMatrixData, origin: IPointData, angle: number): void {
M.translateInner(t, origin.x, origin.y)
M.rotate(t, angle)
M.translateInner(t, -center.x, -center.y)
M.translateInner(t, -origin.x, -origin.y)
},

@@ -109,11 +109,11 @@

skewOf(t: IMatrixData, center: IPointData, x: number, y?: number): void {
M.toInnerPoint(t, center, tempPoint)
skewOfOuter(t: IMatrixData, origin: IPointData, x: number, y?: number): void {
M.toInnerPoint(t, origin, tempPoint)
M.skewOfInner(t, tempPoint, x, y)
},
skewOfInner(t: IMatrixData, center: IPointData, x: number, y?: number): void {
M.translateInner(t, center.x, center.y)
skewOfInner(t: IMatrixData, origin: IPointData, x: number, y?: number): void {
M.translateInner(t, origin.x, origin.y)
M.skew(t, x, y)
M.translateInner(t, -center.x, -center.y)
M.translateInner(t, -origin.x, -origin.y)
},

@@ -120,0 +120,0 @@

@@ -27,2 +27,6 @@ import { IPointData, IMatrixData, IRadiusPointData } from '@leafer/interface'

move(t: IPointData, x: number, y: number): void {
t.x += x
t.y += y
},

@@ -47,2 +51,9 @@ rotate(t: IPointData, rotation: number, center?: IPointData): void {

tempToOuterOf(t: IPointData, matrix: IMatrixData): IPointData {
const { tempPoint: temp } = P
P.copy(temp, t)
toOuterPoint(matrix, temp, temp)
return temp
},
tempToInnerRadiusPointOf(t: IRadiusPointData, matrix: IMatrixData): IRadiusPointData {

@@ -49,0 +60,0 @@ const { tempRadiusPoint: temp } = P