modern-canvas 0.16.1 → 0.16.2
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.js +8 -8
- package/dist/scene/main/Node.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3395,7 +3395,7 @@ var On = class extends j {
|
|
|
3395
3395
|
}
|
|
3396
3396
|
toPixels(e = 0, t = 0, n = this.gl.drawingBufferWidth, r = this.gl.drawingBufferHeight) {
|
|
3397
3397
|
let i = n * r * 4, a = n * 4, o = (r - 1) * a, s = new Uint8Array(i), c = new Uint8ClampedArray(i);
|
|
3398
|
-
this.gl.readPixels(e, t, n, r, this.gl.RGBA, this.gl.UNSIGNED_BYTE, s);
|
|
3398
|
+
this.gl.readPixels(e, this.gl.drawingBufferHeight - t - r, n, r, this.gl.RGBA, this.gl.UNSIGNED_BYTE, s);
|
|
3399
3399
|
for (let e = 0; e < i; e += a) c.set(s.subarray(e, e + a), o - e);
|
|
3400
3400
|
return c;
|
|
3401
3401
|
}
|
|
@@ -4518,9 +4518,9 @@ var B = or = class extends st {
|
|
|
4518
4518
|
let t = e.getIndex();
|
|
4519
4519
|
return this.equal(e.parent) && t > -1 && (this.getChildren(e.internalMode).splice(t, 1), e.setParent(void 0), this.emit("removeChild", e, t)), e;
|
|
4520
4520
|
}
|
|
4521
|
-
removeChildren() {
|
|
4522
|
-
let
|
|
4523
|
-
for (let
|
|
4521
|
+
removeChildren(e = "default") {
|
|
4522
|
+
let t = this.getChildren(e).slice();
|
|
4523
|
+
for (let e = 0, n = t.length; e < n; e++) this.removeChild(t[e]);
|
|
4524
4524
|
}
|
|
4525
4525
|
remove() {
|
|
4526
4526
|
this._parent?.removeChild(this);
|
|
@@ -8748,17 +8748,17 @@ var Va = "WeakRef" in globalThis, Ha = class extends e {
|
|
|
8748
8748
|
}
|
|
8749
8749
|
toPixels() {
|
|
8750
8750
|
if (this.needsChunkReadPixels()) {
|
|
8751
|
-
let { width: e, height: t } = this.root, { drawingBufferWidth: n, drawingBufferHeight: r } = this.gl, i = this.root.canvasTransform.clone(), a = new Uint8ClampedArray(e * t * 4), o = Math.ceil(e / n), s = Math.ceil(t / r);
|
|
8751
|
+
let { width: e, height: t } = this.root, { drawingBufferWidth: n, drawingBufferHeight: r } = this.gl, i = this.root.canvasTransform.clone().translate(0, t - r), a = new Uint8ClampedArray(e * t * 4), o = Math.ceil(e / n), s = Math.ceil(t / r);
|
|
8752
8752
|
for (let c = 0; c < s; c++) for (let s = 0; s < o; s++) {
|
|
8753
8753
|
let o = s * n, l = c * r, u = Math.min(n, e - o), d = Math.min(r, t - l);
|
|
8754
|
-
this.
|
|
8754
|
+
this.root.canvasTransform.copyFrom(i.clone().translate(-o, -l)), this.render();
|
|
8755
8755
|
let f = this.renderer.toPixels(0, 0, u, d);
|
|
8756
8756
|
for (let t = 0; t < d; t++) {
|
|
8757
8757
|
let n = t * u * 4, r = ((l + t) * e + o) * 4;
|
|
8758
8758
|
a.set(f.subarray(n, n + u * 4), r);
|
|
8759
8759
|
}
|
|
8760
8760
|
}
|
|
8761
|
-
return (o > 1 || s > 1) && (this.
|
|
8761
|
+
return (o > 1 || s > 1) && (this.root.canvasTransform.copyFrom(i), this.render()), a;
|
|
8762
8762
|
} else return this.renderer.toPixels();
|
|
8763
8763
|
}
|
|
8764
8764
|
toImageData() {
|
|
@@ -8806,7 +8806,7 @@ async function Ya(e = 100) {
|
|
|
8806
8806
|
}
|
|
8807
8807
|
async function Xa(e) {
|
|
8808
8808
|
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = Ja();
|
|
8809
|
-
f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length && await new Promise((e) => {
|
|
8809
|
+
f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length && await new Promise((e) => {
|
|
8810
8810
|
let t = 0, n = o.length, r = o[n - 1];
|
|
8811
8811
|
async function i() {
|
|
8812
8812
|
if (t === n) return e();
|
|
@@ -135,7 +135,7 @@ export declare class Node extends CoreObject {
|
|
|
135
135
|
appendChild<T extends Node>(node: T, internalMode?: InternalMode): T;
|
|
136
136
|
moveChild(node: Node, toIndex: number, internalMode?: InternalMode): this;
|
|
137
137
|
removeChild<T extends Node>(child: T): T;
|
|
138
|
-
removeChildren(): void;
|
|
138
|
+
removeChildren(internalMode?: InternalMode | true): void;
|
|
139
139
|
remove(): void;
|
|
140
140
|
findOne<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
141
141
|
findAll<T extends Node = Node>(callbackfn: (value: Node) => boolean): T[];
|