@napi-rs/canvas 0.1.78 → 0.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/geometry.js +18 -11
  2. package/package.json +12 -12
package/geometry.js CHANGED
@@ -729,7 +729,7 @@ class DOMMatrix {
729
729
  }
730
730
 
731
731
  inverse() {
732
- return newInstance(this[VALUES]).invertSelf()
732
+ return newInstance(this[VALUES].slice()).invertSelf()
733
733
  }
734
734
 
735
735
  invertSelf() {
@@ -738,16 +738,21 @@ class DOMMatrix {
738
738
 
739
739
  // Invertable
740
740
  if (det !== 0) {
741
- const result = new DOMMatrix()
742
-
743
- result.a = this[VALUES][D] / det
744
- result.b = -this[VALUES][B] / det
745
- result.c = -this[VALUES][C] / det
746
- result.d = this[VALUES][A] / det
747
- result.e = (this[VALUES][C] * this[VALUES][F] - this[VALUES][D] * this[VALUES][E]) / det
748
- result.f = (this[VALUES][B] * this[VALUES][E] - this[VALUES][A] * this[VALUES][F]) / det
749
-
750
- return result
741
+ const newA = this[VALUES][D] / det
742
+ const newB = -this[VALUES][B] / det
743
+ const newC = -this[VALUES][C] / det
744
+ const newD = this[VALUES][A] / det
745
+ const newE = (this[VALUES][C] * this[VALUES][F] - this[VALUES][D] * this[VALUES][E]) / det
746
+ const newF = (this[VALUES][B] * this[VALUES][E] - this[VALUES][A] * this[VALUES][F]) / det
747
+
748
+ this.a = newA
749
+ this.b = newB
750
+ this.c = newC
751
+ this.d = newD
752
+ this.e = newE
753
+ this.f = newF
754
+
755
+ return this
751
756
  }
752
757
 
753
758
  // Not invertable
@@ -755,6 +760,8 @@ class DOMMatrix {
755
760
  this[IS_2D] = false
756
761
 
757
762
  this[VALUES] = [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]
763
+
764
+ return this
758
765
  }
759
766
  } else {
760
767
  throw new Error('3D matrix inversion is not implemented.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/canvas",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
4
4
  "description": "Canvas for Node.js with skia backend",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -90,7 +90,7 @@
90
90
  "conventional-changelog-cli": "^5.0.0",
91
91
  "core-js": "^3.42.0",
92
92
  "echarts": "^6.0.0",
93
- "electron": "^37.1.0",
93
+ "electron": "^38.0.0",
94
94
  "husky": "^9.1.7",
95
95
  "lint-staged": "^16.1.0",
96
96
  "lodash": "^4.17.21",
@@ -143,15 +143,15 @@
143
143
  },
144
144
  "packageManager": "yarn@4.9.4",
145
145
  "optionalDependencies": {
146
- "@napi-rs/canvas-linux-x64-gnu": "0.1.78",
147
- "@napi-rs/canvas-darwin-x64": "0.1.78",
148
- "@napi-rs/canvas-win32-x64-msvc": "0.1.78",
149
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.78",
150
- "@napi-rs/canvas-linux-x64-musl": "0.1.78",
151
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.78",
152
- "@napi-rs/canvas-linux-arm64-musl": "0.1.78",
153
- "@napi-rs/canvas-darwin-arm64": "0.1.78",
154
- "@napi-rs/canvas-android-arm64": "0.1.78",
155
- "@napi-rs/canvas-linux-riscv64-gnu": "0.1.78"
146
+ "@napi-rs/canvas-linux-x64-gnu": "0.1.79",
147
+ "@napi-rs/canvas-darwin-x64": "0.1.79",
148
+ "@napi-rs/canvas-win32-x64-msvc": "0.1.79",
149
+ "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.79",
150
+ "@napi-rs/canvas-linux-x64-musl": "0.1.79",
151
+ "@napi-rs/canvas-linux-arm64-gnu": "0.1.79",
152
+ "@napi-rs/canvas-linux-arm64-musl": "0.1.79",
153
+ "@napi-rs/canvas-darwin-arm64": "0.1.79",
154
+ "@napi-rs/canvas-android-arm64": "0.1.79",
155
+ "@napi-rs/canvas-linux-riscv64-gnu": "0.1.79"
156
156
  }
157
157
  }