modern-canvas 0.6.8 → 0.6.10
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 +36 -55
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +46 -95
- package/dist/index.mjs +36 -55
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -5776,9 +5776,6 @@ exports.Node = class Node extends CoreObject {
|
|
|
5776
5776
|
return false;
|
|
5777
5777
|
}
|
|
5778
5778
|
}
|
|
5779
|
-
_update(changed) {
|
|
5780
|
-
super._update(changed);
|
|
5781
|
-
}
|
|
5782
5779
|
_updateProperty(key, value, oldValue, declaration) {
|
|
5783
5780
|
super._updateProperty(key, value, oldValue, declaration);
|
|
5784
5781
|
}
|
|
@@ -7104,29 +7101,26 @@ class CanvasContext extends modernPath2d.Path2D {
|
|
|
7104
7101
|
}
|
|
7105
7102
|
}
|
|
7106
7103
|
stroke(options) {
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
if (this.strokeStyle) {
|
|
7110
|
-
texture = this._toTexture(this.strokeStyle);
|
|
7111
|
-
}
|
|
7112
|
-
if (this.curves.length) {
|
|
7113
|
-
this._draws.push({
|
|
7114
|
-
...options,
|
|
7115
|
-
type: "stroke",
|
|
7116
|
-
path,
|
|
7117
|
-
texture,
|
|
7118
|
-
uvTransform: this.uvTransform,
|
|
7119
|
-
vertTransform: this.vertTransform,
|
|
7120
|
-
style: {
|
|
7121
|
-
alignment: 0.5,
|
|
7122
|
-
cap: this.lineCap ?? "butt",
|
|
7123
|
-
join: this.lineJoin ?? "miter",
|
|
7124
|
-
width: this.lineWidth ?? 1,
|
|
7125
|
-
miterLimit: this.miterLimit ?? 10
|
|
7126
|
-
}
|
|
7127
|
-
});
|
|
7128
|
-
super.reset();
|
|
7104
|
+
if (!this.curves.length) {
|
|
7105
|
+
return;
|
|
7129
7106
|
}
|
|
7107
|
+
const strokeStyle = this.strokeStyle ?? (typeof this.style.stroke === "string" ? this.style.stroke : void 0);
|
|
7108
|
+
this._draws.push({
|
|
7109
|
+
...options,
|
|
7110
|
+
type: "stroke",
|
|
7111
|
+
path: new modernPath2d.Path2D(this),
|
|
7112
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7113
|
+
uvTransform: this.uvTransform,
|
|
7114
|
+
vertTransform: this.vertTransform,
|
|
7115
|
+
style: {
|
|
7116
|
+
alignment: 0.5,
|
|
7117
|
+
cap: this.lineCap ?? "butt",
|
|
7118
|
+
join: this.lineJoin ?? "miter",
|
|
7119
|
+
width: this.lineWidth ?? 1,
|
|
7120
|
+
miterLimit: this.miterLimit ?? 10
|
|
7121
|
+
}
|
|
7122
|
+
});
|
|
7123
|
+
super.reset();
|
|
7130
7124
|
}
|
|
7131
7125
|
fillRect(x, y, width, height) {
|
|
7132
7126
|
this.rect(x, y, width, height).fill();
|
|
@@ -7135,16 +7129,15 @@ class CanvasContext extends modernPath2d.Path2D {
|
|
|
7135
7129
|
this.rect(x, y, width, height).stroke();
|
|
7136
7130
|
}
|
|
7137
7131
|
fill(options) {
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
if (this.fillStyle) {
|
|
7141
|
-
texture = this._toTexture(this.fillStyle);
|
|
7132
|
+
if (!this.curves.length) {
|
|
7133
|
+
return;
|
|
7142
7134
|
}
|
|
7135
|
+
const fillStyle = this.fillStyle ?? (typeof this.style.fill === "string" ? this.style.fill : void 0);
|
|
7143
7136
|
this._draws.push({
|
|
7144
7137
|
...options,
|
|
7145
7138
|
type: "fill",
|
|
7146
|
-
path,
|
|
7147
|
-
texture,
|
|
7139
|
+
path: new modernPath2d.Path2D(this),
|
|
7140
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7148
7141
|
uvTransform: this.uvTransform,
|
|
7149
7142
|
vertTransform: this.vertTransform
|
|
7150
7143
|
});
|
|
@@ -7303,15 +7296,12 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
7303
7296
|
}
|
|
7304
7297
|
requestRedraw() {
|
|
7305
7298
|
this._redrawing = true;
|
|
7306
|
-
this.requestUpdate();
|
|
7307
7299
|
}
|
|
7308
7300
|
requestRelayout() {
|
|
7309
7301
|
this._relayouting = true;
|
|
7310
|
-
this.requestUpdate();
|
|
7311
7302
|
}
|
|
7312
7303
|
requestRepaint() {
|
|
7313
7304
|
this._repainting = true;
|
|
7314
|
-
this.requestUpdate();
|
|
7315
7305
|
}
|
|
7316
7306
|
_updateGlobalVisible() {
|
|
7317
7307
|
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
@@ -7350,22 +7340,14 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
7350
7340
|
_process(delta) {
|
|
7351
7341
|
super._process(delta);
|
|
7352
7342
|
const parent = this.getParent();
|
|
7353
|
-
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
7354
|
-
this.requestUpdate();
|
|
7355
|
-
}
|
|
7356
|
-
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
7357
|
-
this.requestUpdate();
|
|
7358
|
-
}
|
|
7359
|
-
}
|
|
7360
|
-
_update(changed) {
|
|
7361
|
-
super._update(changed);
|
|
7362
|
-
const parent = this.getParent();
|
|
7363
7343
|
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
7364
7344
|
this._updateGlobalVisible();
|
|
7365
7345
|
}
|
|
7366
7346
|
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
7367
7347
|
this._updateGlobalOpacity();
|
|
7368
7348
|
}
|
|
7349
|
+
}
|
|
7350
|
+
_updateBatchables() {
|
|
7369
7351
|
const redrawing = this._redrawing;
|
|
7370
7352
|
let relayouting = this._relayouting;
|
|
7371
7353
|
let repainting = this._repainting;
|
|
@@ -7394,6 +7376,7 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
7394
7376
|
}
|
|
7395
7377
|
}
|
|
7396
7378
|
_render(renderer) {
|
|
7379
|
+
this._updateBatchables();
|
|
7397
7380
|
this._batchables.forEach((batchable) => {
|
|
7398
7381
|
batchable.texture?.upload(renderer);
|
|
7399
7382
|
renderer.batch2D.render({
|
|
@@ -9345,15 +9328,13 @@ class BaseElement2DText extends CoreObject {
|
|
|
9345
9328
|
draw() {
|
|
9346
9329
|
const ctx = this.parent.context;
|
|
9347
9330
|
this.base.update();
|
|
9348
|
-
this.base.
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
ctx.fill();
|
|
9356
|
-
});
|
|
9331
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9332
|
+
pathSet.paths.forEach((path) => {
|
|
9333
|
+
ctx.addPath(path);
|
|
9334
|
+
ctx.style = { ...path.style };
|
|
9335
|
+
ctx.fillStyle = void 0;
|
|
9336
|
+
ctx.strokeStyle = void 0;
|
|
9337
|
+
ctx.fill();
|
|
9357
9338
|
});
|
|
9358
9339
|
});
|
|
9359
9340
|
}
|
|
@@ -9402,7 +9383,7 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
9402
9383
|
super._updateProperty(key, value, oldValue, declaration);
|
|
9403
9384
|
switch (key) {
|
|
9404
9385
|
case "rotation":
|
|
9405
|
-
this.
|
|
9386
|
+
this.requestRelayout();
|
|
9406
9387
|
break;
|
|
9407
9388
|
}
|
|
9408
9389
|
}
|
|
@@ -13597,7 +13578,7 @@ exports.CanvasItemEditor = class CanvasItemEditor extends exports.Control {
|
|
|
13597
13578
|
style: {
|
|
13598
13579
|
width: 500,
|
|
13599
13580
|
height: 500,
|
|
13600
|
-
backgroundColor: "#
|
|
13581
|
+
backgroundColor: "#00FFFFFF",
|
|
13601
13582
|
// overflow: 'hidden',
|
|
13602
13583
|
pointerEvents: "none"
|
|
13603
13584
|
// boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)',
|
package/dist/index.d.cts
CHANGED
|
@@ -1667,7 +1667,6 @@ declare class Node extends CoreObject {
|
|
|
1667
1667
|
get lastSibling(): Node | undefined;
|
|
1668
1668
|
canProcess(): boolean;
|
|
1669
1669
|
canRender(): boolean;
|
|
1670
|
-
protected _update(changed: Map<string, any>): void;
|
|
1671
1670
|
protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1672
1671
|
protected _onTreeEnter(tree: SceneTree): void;
|
|
1673
1672
|
protected _onTreeExit(oldTree: SceneTree): void;
|
|
@@ -1799,7 +1798,7 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1799
1798
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1800
1799
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1801
1800
|
protected _process(delta: number): void;
|
|
1802
|
-
protected
|
|
1801
|
+
protected _updateBatchables(): void;
|
|
1803
1802
|
protected _render(renderer: WebGLRenderer): void;
|
|
1804
1803
|
}
|
|
1805
1804
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1667,7 +1667,6 @@ declare class Node extends CoreObject {
|
|
|
1667
1667
|
get lastSibling(): Node | undefined;
|
|
1668
1668
|
canProcess(): boolean;
|
|
1669
1669
|
canRender(): boolean;
|
|
1670
|
-
protected _update(changed: Map<string, any>): void;
|
|
1671
1670
|
protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1672
1671
|
protected _onTreeEnter(tree: SceneTree): void;
|
|
1673
1672
|
protected _onTreeExit(oldTree: SceneTree): void;
|
|
@@ -1799,7 +1798,7 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1799
1798
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1800
1799
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1801
1800
|
protected _process(delta: number): void;
|
|
1802
|
-
protected
|
|
1801
|
+
protected _updateBatchables(): void;
|
|
1803
1802
|
protected _render(renderer: WebGLRenderer): void;
|
|
1804
1803
|
}
|
|
1805
1804
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1667,7 +1667,6 @@ declare class Node extends CoreObject {
|
|
|
1667
1667
|
get lastSibling(): Node | undefined;
|
|
1668
1668
|
canProcess(): boolean;
|
|
1669
1669
|
canRender(): boolean;
|
|
1670
|
-
protected _update(changed: Map<string, any>): void;
|
|
1671
1670
|
protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1672
1671
|
protected _onTreeEnter(tree: SceneTree): void;
|
|
1673
1672
|
protected _onTreeExit(oldTree: SceneTree): void;
|
|
@@ -1799,7 +1798,7 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1799
1798
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1800
1799
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1801
1800
|
protected _process(delta: number): void;
|
|
1802
|
-
protected
|
|
1801
|
+
protected _updateBatchables(): void;
|
|
1803
1802
|
protected _render(renderer: WebGLRenderer): void;
|
|
1804
1803
|
}
|
|
1805
1804
|
|