modern-canvas 0.6.12 → 0.6.13

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.
package/dist/index.mjs CHANGED
@@ -955,6 +955,8 @@ class CoreObject extends EventEmitter {
955
955
  if (value && typeof value === "object") {
956
956
  if ("toJSON" in value && typeof value.toJSON === "function") {
957
957
  json[key] = value.toJSON();
958
+ } else if (Array.isArray(value)) {
959
+ json[key] = [...value];
958
960
  } else {
959
961
  json[key] = { ...value };
960
962
  }
@@ -2439,7 +2441,7 @@ attribute vec4 aColorMatrixOffset;
2439
2441
  attribute vec4 aDisableWrapMode;
2440
2442
 
2441
2443
  uniform mat3 projectionMatrix;
2442
- uniform mat3 translationMatrix;
2444
+ uniform mat3 worldTransformMatrix;
2443
2445
  uniform vec4 modulate;
2444
2446
 
2445
2447
  varying float vTextureId;
@@ -2451,8 +2453,14 @@ varying vec4 vColorMatrixOffset;
2451
2453
  varying vec4 vDisableWrapMode;
2452
2454
 
2453
2455
  void main(void) {
2456
+ mat3 modelMatrix = mat3(
2457
+ 1.0, 0.0, 0.0,
2458
+ 0.0, 1.0, 0.0,
2459
+ 0.0, 0.0, 1.0
2460
+ );
2454
2461
  vTextureId = aTextureId;
2455
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
2462
+ mat3 modelViewProjectionMatrix = projectionMatrix * worldTransformMatrix * modelMatrix;
2463
+ gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
2456
2464
  vUv = aUv;
2457
2465
  vModulate = aModulate * modulate;
2458
2466
  vBackgroundColor = aBackgroundColor;
@@ -2543,7 +2551,6 @@ void main(void) {
2543
2551
  renderer2.program.updateUniforms(program, {
2544
2552
  samplers,
2545
2553
  modulate: [1, 1, 1, 1],
2546
- translationMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
2547
2554
  ...renderer2.program.uniforms
2548
2555
  });
2549
2556
  renderer2.vertexArray.bind(vao ?? vertexArray);
@@ -3198,7 +3205,8 @@ class WebGLProgramModule extends WebGLModule {
3198
3205
  }
3199
3206
  boundProgram = null;
3200
3207
  uniforms = {
3201
- projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3208
+ projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
3209
+ worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3202
3210
  };
3203
3211
  create(options) {
3204
3212
  const program = this.gl.createProgram();
@@ -3400,7 +3408,10 @@ ${gl.getShaderInfoLog(shader)}`);
3400
3408
  reset() {
3401
3409
  super.reset();
3402
3410
  this.boundProgram = null;
3403
- this.uniforms = {};
3411
+ this.uniforms = {
3412
+ projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
3413
+ worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3414
+ };
3404
3415
  }
3405
3416
  free() {
3406
3417
  super.free();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.6.12",
4
+ "version": "0.6.13",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",
@@ -70,7 +70,7 @@
70
70
  "colord": "^2.9.3",
71
71
  "earcut": "^3.0.1",
72
72
  "modern-font": "^0.4.1",
73
- "modern-idoc": "^0.8.5",
73
+ "modern-idoc": "^0.8.6",
74
74
  "modern-path2d": "^1.4.5",
75
75
  "modern-text": "^1.7.1",
76
76
  "yoga-layout": "^3.2.1"
@@ -78,7 +78,7 @@
78
78
  "devDependencies": {
79
79
  "@antfu/eslint-config": "^4.16.2",
80
80
  "@types/earcut": "^3.0.0",
81
- "@types/node": "^24.0.12",
81
+ "@types/node": "^24.0.13",
82
82
  "bumpp": "^10.2.0",
83
83
  "conventional-changelog-cli": "^5.0.0",
84
84
  "eslint": "^9.30.1",