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.cjs CHANGED
@@ -961,6 +961,8 @@ class CoreObject extends modernIdoc.EventEmitter {
961
961
  if (value && typeof value === "object") {
962
962
  if ("toJSON" in value && typeof value.toJSON === "function") {
963
963
  json[key] = value.toJSON();
964
+ } else if (Array.isArray(value)) {
965
+ json[key] = [...value];
964
966
  } else {
965
967
  json[key] = { ...value };
966
968
  }
@@ -2445,7 +2447,7 @@ attribute vec4 aColorMatrixOffset;
2445
2447
  attribute vec4 aDisableWrapMode;
2446
2448
 
2447
2449
  uniform mat3 projectionMatrix;
2448
- uniform mat3 translationMatrix;
2450
+ uniform mat3 worldTransformMatrix;
2449
2451
  uniform vec4 modulate;
2450
2452
 
2451
2453
  varying float vTextureId;
@@ -2457,8 +2459,14 @@ varying vec4 vColorMatrixOffset;
2457
2459
  varying vec4 vDisableWrapMode;
2458
2460
 
2459
2461
  void main(void) {
2462
+ mat3 modelMatrix = mat3(
2463
+ 1.0, 0.0, 0.0,
2464
+ 0.0, 1.0, 0.0,
2465
+ 0.0, 0.0, 1.0
2466
+ );
2460
2467
  vTextureId = aTextureId;
2461
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
2468
+ mat3 modelViewProjectionMatrix = projectionMatrix * worldTransformMatrix * modelMatrix;
2469
+ gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
2462
2470
  vUv = aUv;
2463
2471
  vModulate = aModulate * modulate;
2464
2472
  vBackgroundColor = aBackgroundColor;
@@ -2549,7 +2557,6 @@ void main(void) {
2549
2557
  renderer2.program.updateUniforms(program, {
2550
2558
  samplers,
2551
2559
  modulate: [1, 1, 1, 1],
2552
- translationMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
2553
2560
  ...renderer2.program.uniforms
2554
2561
  });
2555
2562
  renderer2.vertexArray.bind(vao ?? vertexArray);
@@ -3204,7 +3211,8 @@ class WebGLProgramModule extends WebGLModule {
3204
3211
  }
3205
3212
  boundProgram = null;
3206
3213
  uniforms = {
3207
- projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3214
+ projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
3215
+ worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3208
3216
  };
3209
3217
  create(options) {
3210
3218
  const program = this.gl.createProgram();
@@ -3406,7 +3414,10 @@ ${gl.getShaderInfoLog(shader)}`);
3406
3414
  reset() {
3407
3415
  super.reset();
3408
3416
  this.boundProgram = null;
3409
- this.uniforms = {};
3417
+ this.uniforms = {
3418
+ projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
3419
+ worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
3420
+ };
3410
3421
  }
3411
3422
  free() {
3412
3423
  super.free();
package/dist/index.d.cts CHANGED
@@ -1046,7 +1046,10 @@ declare class WebGLMaskModule extends WebGLModule {
1046
1046
  declare class WebGLProgramModule extends WebGLModule {
1047
1047
  install(renderer: WebGLRenderer): void;
1048
1048
  boundProgram: WebGLProgram | null;
1049
- uniforms: Record<string, any>;
1049
+ uniforms: {
1050
+ projectionMatrix: number[];
1051
+ worldTransformMatrix: number[];
1052
+ };
1050
1053
  create(options?: WebGLProgramOptions): WebGLProgram;
1051
1054
  getMeta(program: WebGLProgram): WebGLProgramMeta;
1052
1055
  update(options: WebGLProgramOptions): void;
@@ -1709,8 +1712,7 @@ declare class Node extends CoreObject {
1709
1712
  protected _render(renderer: WebGLRenderer): void;
1710
1713
  clone(): this;
1711
1714
  toJSON(): Record<string, any>;
1712
- static parse(value: Record<string, any>[]): Node[];
1713
- static parse(value: Record<string, any>): Node;
1715
+ static parse(value: any): any;
1714
1716
  }
1715
1717
 
1716
1718
  interface TimelineNodeProperties extends NodeProperties {
package/dist/index.d.mts CHANGED
@@ -1046,7 +1046,10 @@ declare class WebGLMaskModule extends WebGLModule {
1046
1046
  declare class WebGLProgramModule extends WebGLModule {
1047
1047
  install(renderer: WebGLRenderer): void;
1048
1048
  boundProgram: WebGLProgram | null;
1049
- uniforms: Record<string, any>;
1049
+ uniforms: {
1050
+ projectionMatrix: number[];
1051
+ worldTransformMatrix: number[];
1052
+ };
1050
1053
  create(options?: WebGLProgramOptions): WebGLProgram;
1051
1054
  getMeta(program: WebGLProgram): WebGLProgramMeta;
1052
1055
  update(options: WebGLProgramOptions): void;
@@ -1709,8 +1712,7 @@ declare class Node extends CoreObject {
1709
1712
  protected _render(renderer: WebGLRenderer): void;
1710
1713
  clone(): this;
1711
1714
  toJSON(): Record<string, any>;
1712
- static parse(value: Record<string, any>[]): Node[];
1713
- static parse(value: Record<string, any>): Node;
1715
+ static parse(value: any): any;
1714
1716
  }
1715
1717
 
1716
1718
  interface TimelineNodeProperties extends NodeProperties {
package/dist/index.d.ts CHANGED
@@ -1046,7 +1046,10 @@ declare class WebGLMaskModule extends WebGLModule {
1046
1046
  declare class WebGLProgramModule extends WebGLModule {
1047
1047
  install(renderer: WebGLRenderer): void;
1048
1048
  boundProgram: WebGLProgram | null;
1049
- uniforms: Record<string, any>;
1049
+ uniforms: {
1050
+ projectionMatrix: number[];
1051
+ worldTransformMatrix: number[];
1052
+ };
1050
1053
  create(options?: WebGLProgramOptions): WebGLProgram;
1051
1054
  getMeta(program: WebGLProgram): WebGLProgramMeta;
1052
1055
  update(options: WebGLProgramOptions): void;
@@ -1709,8 +1712,7 @@ declare class Node extends CoreObject {
1709
1712
  protected _render(renderer: WebGLRenderer): void;
1710
1713
  clone(): this;
1711
1714
  toJSON(): Record<string, any>;
1712
- static parse(value: Record<string, any>[]): Node[];
1713
- static parse(value: Record<string, any>): Node;
1715
+ static parse(value: any): any;
1714
1716
  }
1715
1717
 
1716
1718
  interface TimelineNodeProperties extends NodeProperties {