modern-canvas 0.6.2 → 0.6.4

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
@@ -5651,6 +5651,7 @@ function getNodeIid(key) {
5651
5651
  return iid;
5652
5652
  }
5653
5653
  let Node = class extends CoreObject {
5654
+ meta = {};
5654
5655
  _readyed = false;
5655
5656
  constructor(properties, nodes = []) {
5656
5657
  super();
@@ -6103,7 +6104,8 @@ let Node = class extends CoreObject {
6103
6104
  return clearUndef({
6104
6105
  ...super.toJSON(),
6105
6106
  is: this.is,
6106
- children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0
6107
+ children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0,
6108
+ meta: Object.keys(this.meta).length ? { ...this.meta } : void 0
6107
6109
  });
6108
6110
  }
6109
6111
  static parse(value) {
@@ -6135,9 +6137,6 @@ __decorateClass$Q([
6135
6137
  __decorateClass$Q([
6136
6138
  property({ fallback: "default" })
6137
6139
  ], Node.prototype, "internalMode", 2);
6138
- __decorateClass$Q([
6139
- property({ default: () => ({}) })
6140
- ], Node.prototype, "meta", 2);
6141
6140
  __decorateClass$Q([
6142
6141
  property({ protected: true })
6143
6142
  ], Node.prototype, "mask", 2);
@@ -9540,7 +9539,10 @@ var __decorateClass$l = (decorators, target, key, kind) => {
9540
9539
  return result;
9541
9540
  };
9542
9541
  let BaseElement2D = class extends Node2D {
9543
- size = new Vector2().on("update", () => this.updateGlobalTransform());
9542
+ size = new Vector2().on("update", () => {
9543
+ this.updateGlobalTransform();
9544
+ this.requestRedraw();
9545
+ });
9544
9546
  get style() {
9545
9547
  return this._style;
9546
9548
  }
@@ -9634,15 +9636,6 @@ let BaseElement2D = class extends Node2D {
9634
9636
  return this;
9635
9637
  }
9636
9638
  _updateStyleProperty(key, value, _oldValue, _declaration) {
9637
- switch (key) {
9638
- case "width":
9639
- case "height":
9640
- if (this.mask instanceof BaseElement2D) {
9641
- this.mask.size.x = this.size.x;
9642
- this.mask.size.y = this.size.y;
9643
- }
9644
- break;
9645
- }
9646
9639
  switch (key) {
9647
9640
  case "rotate":
9648
9641
  this.rotation = this.style.rotate * DEG_TO_RAD;
@@ -9935,6 +9928,15 @@ let Element2D = class extends BaseElement2D {
9935
9928
  this.size.height = Number(value);
9936
9929
  break;
9937
9930
  }
9931
+ switch (key) {
9932
+ case "width":
9933
+ case "height":
9934
+ if (this.mask instanceof BaseElement2D) {
9935
+ this.mask.size.width = this.size.width;
9936
+ this.mask.size.height = this.size.height;
9937
+ }
9938
+ break;
9939
+ }
9938
9940
  }
9939
9941
  };
9940
9942
  Element2D = __decorateClass$k([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",