modern-canvas 0.4.7 → 0.4.8

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
@@ -5892,6 +5892,17 @@ let Node = class extends CoreObject {
5892
5892
  this._parent.moveChild(sibling, this.getIndex(true) + 1);
5893
5893
  return this;
5894
5894
  }
5895
+ prepend(...nodes) {
5896
+ let _nodes;
5897
+ if (Array.isArray(nodes[0])) {
5898
+ _nodes = nodes[0];
5899
+ } else {
5900
+ _nodes = nodes;
5901
+ }
5902
+ _nodes.forEach((node) => {
5903
+ this.moveChild(node, 0);
5904
+ });
5905
+ }
5895
5906
  append(...nodes) {
5896
5907
  let _nodes;
5897
5908
  if (Array.isArray(nodes[0])) {
@@ -5903,6 +5914,35 @@ let Node = class extends CoreObject {
5903
5914
  this.appendChild(node);
5904
5915
  });
5905
5916
  }
5917
+ before(...nodes) {
5918
+ let _nodes;
5919
+ if (Array.isArray(nodes[0])) {
5920
+ _nodes = nodes[0];
5921
+ } else {
5922
+ _nodes = nodes;
5923
+ }
5924
+ _nodes.forEach((node) => {
5925
+ this._parent?.moveChild(node, this.getIndex(true));
5926
+ });
5927
+ }
5928
+ after(...nodes) {
5929
+ let _nodes;
5930
+ if (Array.isArray(nodes[0])) {
5931
+ _nodes = nodes[0];
5932
+ } else {
5933
+ _nodes = nodes;
5934
+ }
5935
+ _nodes.forEach((node) => {
5936
+ this._parent?.moveChild(node, this.getIndex(true) + 1);
5937
+ });
5938
+ }
5939
+ insertBefore(node, child) {
5940
+ if (!child.hasParent() || !this.is(child.parent)) {
5941
+ return node;
5942
+ }
5943
+ this.moveChild(node, child.getIndex(true));
5944
+ return node;
5945
+ }
5906
5946
  appendChild(node, internalMode = node.internalMode) {
5907
5947
  if (this.is(node) || node.hasParent()) {
5908
5948
  return node;
@@ -8101,6 +8141,16 @@ let CanvasItem = class extends TimelineNode {
8101
8141
  };
8102
8142
  });
8103
8143
  }
8144
+ _process(delta) {
8145
+ super._process(delta);
8146
+ const parent = this.getParent();
8147
+ if (this._parentGlobalVisible !== parent?.globalVisible) {
8148
+ this.requestUpdate();
8149
+ }
8150
+ if (this._parentGlobalOpacity !== parent?.globalOpacity) {
8151
+ this.requestUpdate();
8152
+ }
8153
+ }
8104
8154
  _update() {
8105
8155
  const parent = this.getParent();
8106
8156
  if (this._parentGlobalVisible !== parent?.globalVisible) {
@@ -8687,11 +8737,11 @@ let Node2D = class extends CanvasItem {
8687
8737
  });
8688
8738
  }
8689
8739
  _process(delta) {
8740
+ super._process(delta);
8690
8741
  const parent = this.getParent();
8691
8742
  if (this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
8692
8743
  this.requestRelayout();
8693
8744
  }
8694
- super._process(delta);
8695
8745
  }
8696
8746
  };
8697
8747
  Node2D = __decorateClass$n([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.4.7",
4
+ "version": "0.4.8",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",