modern-canvas 0.1.0 → 0.1.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/README.md +23 -14
- package/dist/index.cjs +257 -322
- package/dist/index.d.cts +46 -90
- package/dist/index.d.mts +46 -90
- package/dist/index.d.ts +46 -90
- package/dist/index.js +41 -41
- package/dist/index.mjs +259 -323
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const colord = require('colord');
|
|
4
4
|
const namesPlugin = require('colord/plugins/names');
|
|
5
5
|
const earcut = require('earcut');
|
|
6
|
+
const modernIdoc = require('modern-idoc');
|
|
6
7
|
const modernText = require('modern-text');
|
|
7
8
|
|
|
8
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -623,13 +624,13 @@ class Geometry extends Resource {
|
|
|
623
624
|
}
|
|
624
625
|
}
|
|
625
626
|
|
|
626
|
-
var __defProp$
|
|
627
|
-
var __decorateClass$
|
|
627
|
+
var __defProp$B = Object.defineProperty;
|
|
628
|
+
var __decorateClass$B = (decorators, target, key, kind) => {
|
|
628
629
|
var result = void 0 ;
|
|
629
630
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
630
631
|
if (decorator = decorators[i])
|
|
631
632
|
result = (decorator(target, key, result) ) || result;
|
|
632
|
-
if (result) __defProp$
|
|
633
|
+
if (result) __defProp$B(target, key, result);
|
|
633
634
|
return result;
|
|
634
635
|
};
|
|
635
636
|
class IndexBuffer extends Resource {
|
|
@@ -673,20 +674,20 @@ class IndexBuffer extends Resource {
|
|
|
673
674
|
return result;
|
|
674
675
|
}
|
|
675
676
|
}
|
|
676
|
-
__decorateClass$
|
|
677
|
+
__decorateClass$B([
|
|
677
678
|
protectedProperty({ default: null })
|
|
678
679
|
], IndexBuffer.prototype, "data");
|
|
679
|
-
__decorateClass$
|
|
680
|
+
__decorateClass$B([
|
|
680
681
|
protectedProperty({ default: false })
|
|
681
682
|
], IndexBuffer.prototype, "dynamic");
|
|
682
683
|
|
|
683
|
-
var __defProp$
|
|
684
|
-
var __decorateClass$
|
|
684
|
+
var __defProp$A = Object.defineProperty;
|
|
685
|
+
var __decorateClass$A = (decorators, target, key, kind) => {
|
|
685
686
|
var result = void 0 ;
|
|
686
687
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
687
688
|
if (decorator = decorators[i])
|
|
688
689
|
result = (decorator(target, key, result) ) || result;
|
|
689
|
-
if (result) __defProp$
|
|
690
|
+
if (result) __defProp$A(target, key, result);
|
|
690
691
|
return result;
|
|
691
692
|
};
|
|
692
693
|
class VertexBuffer extends Resource {
|
|
@@ -730,20 +731,20 @@ class VertexBuffer extends Resource {
|
|
|
730
731
|
return result;
|
|
731
732
|
}
|
|
732
733
|
}
|
|
733
|
-
__decorateClass$
|
|
734
|
+
__decorateClass$A([
|
|
734
735
|
protectedProperty({ default: null })
|
|
735
736
|
], VertexBuffer.prototype, "data");
|
|
736
|
-
__decorateClass$
|
|
737
|
+
__decorateClass$A([
|
|
737
738
|
protectedProperty({ default: false })
|
|
738
739
|
], VertexBuffer.prototype, "dynamic");
|
|
739
740
|
|
|
740
|
-
var __defProp$
|
|
741
|
-
var __decorateClass$
|
|
741
|
+
var __defProp$z = Object.defineProperty;
|
|
742
|
+
var __decorateClass$z = (decorators, target, key, kind) => {
|
|
742
743
|
var result = void 0 ;
|
|
743
744
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
744
745
|
if (decorator = decorators[i])
|
|
745
746
|
result = (decorator(target, key, result) ) || result;
|
|
746
|
-
if (result) __defProp$
|
|
747
|
+
if (result) __defProp$z(target, key, result);
|
|
747
748
|
return result;
|
|
748
749
|
};
|
|
749
750
|
class VertexAttribute extends Resource {
|
|
@@ -780,25 +781,25 @@ class VertexAttribute extends Resource {
|
|
|
780
781
|
return result;
|
|
781
782
|
}
|
|
782
783
|
}
|
|
783
|
-
__decorateClass$
|
|
784
|
+
__decorateClass$z([
|
|
784
785
|
protectedProperty()
|
|
785
786
|
], VertexAttribute.prototype, "buffer");
|
|
786
|
-
__decorateClass$
|
|
787
|
+
__decorateClass$z([
|
|
787
788
|
protectedProperty({ default: 0 })
|
|
788
789
|
], VertexAttribute.prototype, "size");
|
|
789
|
-
__decorateClass$
|
|
790
|
+
__decorateClass$z([
|
|
790
791
|
protectedProperty({ default: false })
|
|
791
792
|
], VertexAttribute.prototype, "normalized");
|
|
792
|
-
__decorateClass$
|
|
793
|
+
__decorateClass$z([
|
|
793
794
|
protectedProperty({ default: "float" })
|
|
794
795
|
], VertexAttribute.prototype, "type");
|
|
795
|
-
__decorateClass$
|
|
796
|
+
__decorateClass$z([
|
|
796
797
|
protectedProperty()
|
|
797
798
|
], VertexAttribute.prototype, "stride");
|
|
798
|
-
__decorateClass$
|
|
799
|
+
__decorateClass$z([
|
|
799
800
|
protectedProperty()
|
|
800
801
|
], VertexAttribute.prototype, "offset");
|
|
801
|
-
__decorateClass$
|
|
802
|
+
__decorateClass$z([
|
|
802
803
|
protectedProperty()
|
|
803
804
|
], VertexAttribute.prototype, "divisor");
|
|
804
805
|
|
|
@@ -982,13 +983,13 @@ class UvGeometry extends Geometry {
|
|
|
982
983
|
}
|
|
983
984
|
}
|
|
984
985
|
|
|
985
|
-
var __defProp$
|
|
986
|
-
var __decorateClass$
|
|
986
|
+
var __defProp$y = Object.defineProperty;
|
|
987
|
+
var __decorateClass$y = (decorators, target, key, kind) => {
|
|
987
988
|
var result = void 0 ;
|
|
988
989
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
989
990
|
if (decorator = decorators[i])
|
|
990
991
|
result = (decorator(target, key, result) ) || result;
|
|
991
|
-
if (result) __defProp$
|
|
992
|
+
if (result) __defProp$y(target, key, result);
|
|
992
993
|
return result;
|
|
993
994
|
};
|
|
994
995
|
class MainLoop extends _Object {
|
|
@@ -1029,10 +1030,10 @@ class MainLoop extends _Object {
|
|
|
1029
1030
|
}
|
|
1030
1031
|
}
|
|
1031
1032
|
}
|
|
1032
|
-
__decorateClass$
|
|
1033
|
+
__decorateClass$y([
|
|
1033
1034
|
property({ default: 24 })
|
|
1034
1035
|
], MainLoop.prototype, "fps");
|
|
1035
|
-
__decorateClass$
|
|
1036
|
+
__decorateClass$y([
|
|
1036
1037
|
property({ default: 1 })
|
|
1037
1038
|
], MainLoop.prototype, "speed");
|
|
1038
1039
|
|
|
@@ -4005,14 +4006,14 @@ class Vector4 extends Vector {
|
|
|
4005
4006
|
}
|
|
4006
4007
|
}
|
|
4007
4008
|
|
|
4008
|
-
var __defProp$
|
|
4009
|
-
var __getOwnPropDesc$
|
|
4010
|
-
var __decorateClass$
|
|
4011
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4009
|
+
var __defProp$x = Object.defineProperty;
|
|
4010
|
+
var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
|
|
4011
|
+
var __decorateClass$x = (decorators, target, key, kind) => {
|
|
4012
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
|
|
4012
4013
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4013
4014
|
if (decorator = decorators[i])
|
|
4014
4015
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4015
|
-
if (kind && result) __defProp$
|
|
4016
|
+
if (kind && result) __defProp$x(target, key, result);
|
|
4016
4017
|
return result;
|
|
4017
4018
|
};
|
|
4018
4019
|
var InternalMode = /* @__PURE__ */ ((InternalMode2) => {
|
|
@@ -4410,22 +4411,22 @@ exports.Node = class Node extends Reference {
|
|
|
4410
4411
|
return node;
|
|
4411
4412
|
}
|
|
4412
4413
|
};
|
|
4413
|
-
__decorateClass$
|
|
4414
|
+
__decorateClass$x([
|
|
4414
4415
|
property()
|
|
4415
4416
|
], exports.Node.prototype, "name", 2);
|
|
4416
|
-
__decorateClass$
|
|
4417
|
+
__decorateClass$x([
|
|
4417
4418
|
property()
|
|
4418
4419
|
], exports.Node.prototype, "mask", 2);
|
|
4419
|
-
__decorateClass$
|
|
4420
|
+
__decorateClass$x([
|
|
4420
4421
|
property({ default: "visible" })
|
|
4421
4422
|
], exports.Node.prototype, "visibility", 2);
|
|
4422
|
-
__decorateClass$
|
|
4423
|
+
__decorateClass$x([
|
|
4423
4424
|
property({ default: 0 })
|
|
4424
4425
|
], exports.Node.prototype, "visibleDelay", 2);
|
|
4425
|
-
__decorateClass$
|
|
4426
|
+
__decorateClass$x([
|
|
4426
4427
|
property({ default: Number.MAX_SAFE_INTEGER })
|
|
4427
4428
|
], exports.Node.prototype, "visibleDuration", 2);
|
|
4428
|
-
exports.Node = __decorateClass$
|
|
4429
|
+
exports.Node = __decorateClass$x([
|
|
4429
4430
|
customNode("Node")
|
|
4430
4431
|
], exports.Node);
|
|
4431
4432
|
|
|
@@ -4455,14 +4456,14 @@ class RenderStack {
|
|
|
4455
4456
|
}
|
|
4456
4457
|
}
|
|
4457
4458
|
|
|
4458
|
-
var __defProp$
|
|
4459
|
-
var __getOwnPropDesc$
|
|
4460
|
-
var __decorateClass$
|
|
4461
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4459
|
+
var __defProp$w = Object.defineProperty;
|
|
4460
|
+
var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
|
|
4461
|
+
var __decorateClass$w = (decorators, target, key, kind) => {
|
|
4462
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
|
|
4462
4463
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4463
4464
|
if (decorator = decorators[i])
|
|
4464
4465
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4465
|
-
if (kind && result) __defProp$
|
|
4466
|
+
if (kind && result) __defProp$w(target, key, result);
|
|
4466
4467
|
return result;
|
|
4467
4468
|
};
|
|
4468
4469
|
exports.Timer = class Timer extends exports.Node {
|
|
@@ -4504,29 +4505,29 @@ exports.Timer = class Timer extends exports.Node {
|
|
|
4504
4505
|
this.addTime(delta);
|
|
4505
4506
|
}
|
|
4506
4507
|
};
|
|
4507
|
-
__decorateClass$
|
|
4508
|
+
__decorateClass$w([
|
|
4508
4509
|
property({ default: 0 })
|
|
4509
4510
|
], exports.Timer.prototype, "start", 2);
|
|
4510
|
-
__decorateClass$
|
|
4511
|
+
__decorateClass$w([
|
|
4511
4512
|
property({ default: 0 })
|
|
4512
4513
|
], exports.Timer.prototype, "current", 2);
|
|
4513
|
-
__decorateClass$
|
|
4514
|
+
__decorateClass$w([
|
|
4514
4515
|
property({ default: Number.MAX_SAFE_INTEGER })
|
|
4515
4516
|
], exports.Timer.prototype, "end", 2);
|
|
4516
|
-
__decorateClass$
|
|
4517
|
+
__decorateClass$w([
|
|
4517
4518
|
property({ default: false })
|
|
4518
4519
|
], exports.Timer.prototype, "loop", 2);
|
|
4519
|
-
exports.Timer = __decorateClass$
|
|
4520
|
+
exports.Timer = __decorateClass$w([
|
|
4520
4521
|
customNode("Timer")
|
|
4521
4522
|
], exports.Timer);
|
|
4522
4523
|
|
|
4523
|
-
var __defProp$
|
|
4524
|
-
var __decorateClass$
|
|
4524
|
+
var __defProp$v = Object.defineProperty;
|
|
4525
|
+
var __decorateClass$v = (decorators, target, key, kind) => {
|
|
4525
4526
|
var result = void 0 ;
|
|
4526
4527
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4527
4528
|
if (decorator = decorators[i])
|
|
4528
4529
|
result = (decorator(target, key, result) ) || result;
|
|
4529
|
-
if (result) __defProp$
|
|
4530
|
+
if (result) __defProp$v(target, key, result);
|
|
4530
4531
|
return result;
|
|
4531
4532
|
};
|
|
4532
4533
|
class Texture extends Resource {
|
|
@@ -4652,22 +4653,22 @@ class Texture extends Resource {
|
|
|
4652
4653
|
}
|
|
4653
4654
|
}
|
|
4654
4655
|
}
|
|
4655
|
-
__decorateClass$
|
|
4656
|
+
__decorateClass$v([
|
|
4656
4657
|
protectedProperty()
|
|
4657
4658
|
], Texture.prototype, "source");
|
|
4658
|
-
__decorateClass$
|
|
4659
|
+
__decorateClass$v([
|
|
4659
4660
|
protectedProperty({ default: 0 })
|
|
4660
4661
|
], Texture.prototype, "width");
|
|
4661
|
-
__decorateClass$
|
|
4662
|
+
__decorateClass$v([
|
|
4662
4663
|
protectedProperty({ default: 0 })
|
|
4663
4664
|
], Texture.prototype, "height");
|
|
4664
|
-
__decorateClass$
|
|
4665
|
+
__decorateClass$v([
|
|
4665
4666
|
protectedProperty({ default: "linear" })
|
|
4666
4667
|
], Texture.prototype, "filterMode");
|
|
4667
|
-
__decorateClass$
|
|
4668
|
+
__decorateClass$v([
|
|
4668
4669
|
protectedProperty({ default: "clamp_to_edge" })
|
|
4669
4670
|
], Texture.prototype, "wrapMode");
|
|
4670
|
-
__decorateClass$
|
|
4671
|
+
__decorateClass$v([
|
|
4671
4672
|
protectedProperty({ default: 1 })
|
|
4672
4673
|
], Texture.prototype, "pixelRatio");
|
|
4673
4674
|
|
|
@@ -4803,13 +4804,13 @@ class PixelsTexture extends Texture {
|
|
|
4803
4804
|
}
|
|
4804
4805
|
}
|
|
4805
4806
|
|
|
4806
|
-
var __defProp$
|
|
4807
|
-
var __decorateClass$
|
|
4807
|
+
var __defProp$u = Object.defineProperty;
|
|
4808
|
+
var __decorateClass$u = (decorators, target, key, kind) => {
|
|
4808
4809
|
var result = void 0 ;
|
|
4809
4810
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4810
4811
|
if (decorator = decorators[i])
|
|
4811
4812
|
result = (decorator(target, key, result) ) || result;
|
|
4812
|
-
if (result) __defProp$
|
|
4813
|
+
if (result) __defProp$u(target, key, result);
|
|
4813
4814
|
return result;
|
|
4814
4815
|
};
|
|
4815
4816
|
function resolveOptions(options) {
|
|
@@ -5052,10 +5053,10 @@ const _VideoTexture = class _VideoTexture extends Texture {
|
|
|
5052
5053
|
}
|
|
5053
5054
|
}
|
|
5054
5055
|
};
|
|
5055
|
-
__decorateClass$
|
|
5056
|
+
__decorateClass$u([
|
|
5056
5057
|
protectedProperty({ default: true })
|
|
5057
5058
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5058
|
-
__decorateClass$
|
|
5059
|
+
__decorateClass$u([
|
|
5059
5060
|
protectedProperty({ default: 0 })
|
|
5060
5061
|
], _VideoTexture.prototype, "fps");
|
|
5061
5062
|
let VideoTexture = _VideoTexture;
|
|
@@ -5064,14 +5065,14 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5064
5065
|
//
|
|
5065
5066
|
}
|
|
5066
5067
|
|
|
5067
|
-
var __defProp$
|
|
5068
|
-
var __getOwnPropDesc$
|
|
5069
|
-
var __decorateClass$
|
|
5070
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5068
|
+
var __defProp$t = Object.defineProperty;
|
|
5069
|
+
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
5070
|
+
var __decorateClass$t = (decorators, target, key, kind) => {
|
|
5071
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
|
|
5071
5072
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5072
5073
|
if (decorator = decorators[i])
|
|
5073
5074
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5074
|
-
if (kind && result) __defProp$
|
|
5075
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
5075
5076
|
return result;
|
|
5076
5077
|
};
|
|
5077
5078
|
exports.Viewport = class Viewport extends exports.Node {
|
|
@@ -5192,19 +5193,19 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
5192
5193
|
return this._projection.toArray(transpose);
|
|
5193
5194
|
}
|
|
5194
5195
|
};
|
|
5195
|
-
__decorateClass$
|
|
5196
|
+
__decorateClass$t([
|
|
5196
5197
|
property({ default: 0 })
|
|
5197
5198
|
], exports.Viewport.prototype, "x", 2);
|
|
5198
|
-
__decorateClass$
|
|
5199
|
+
__decorateClass$t([
|
|
5199
5200
|
property({ default: 0 })
|
|
5200
5201
|
], exports.Viewport.prototype, "y", 2);
|
|
5201
|
-
__decorateClass$
|
|
5202
|
+
__decorateClass$t([
|
|
5202
5203
|
property({ default: 0 })
|
|
5203
5204
|
], exports.Viewport.prototype, "width", 2);
|
|
5204
|
-
__decorateClass$
|
|
5205
|
+
__decorateClass$t([
|
|
5205
5206
|
property({ default: 0 })
|
|
5206
5207
|
], exports.Viewport.prototype, "height", 2);
|
|
5207
|
-
exports.Viewport = __decorateClass$
|
|
5208
|
+
exports.Viewport = __decorateClass$t([
|
|
5208
5209
|
customNode({
|
|
5209
5210
|
tag: "Viewport",
|
|
5210
5211
|
renderable: true
|
|
@@ -5623,13 +5624,13 @@ class ColorTexture extends Texture {
|
|
|
5623
5624
|
}
|
|
5624
5625
|
}
|
|
5625
5626
|
|
|
5626
|
-
var __defProp$
|
|
5627
|
-
var __decorateClass$
|
|
5627
|
+
var __defProp$s = Object.defineProperty;
|
|
5628
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
5628
5629
|
var result = void 0 ;
|
|
5629
5630
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5630
5631
|
if (decorator = decorators[i])
|
|
5631
5632
|
result = (decorator(target, key, result) ) || result;
|
|
5632
|
-
if (result) __defProp$
|
|
5633
|
+
if (result) __defProp$s(target, key, result);
|
|
5633
5634
|
return result;
|
|
5634
5635
|
};
|
|
5635
5636
|
function proxy$1() {
|
|
@@ -5785,46 +5786,46 @@ class CanvasContext {
|
|
|
5785
5786
|
return batchables;
|
|
5786
5787
|
}
|
|
5787
5788
|
}
|
|
5788
|
-
__decorateClass$
|
|
5789
|
+
__decorateClass$s([
|
|
5789
5790
|
proxy$1()
|
|
5790
5791
|
], CanvasContext.prototype, "moveTo");
|
|
5791
|
-
__decorateClass$
|
|
5792
|
+
__decorateClass$s([
|
|
5792
5793
|
proxy$1()
|
|
5793
5794
|
], CanvasContext.prototype, "lineTo");
|
|
5794
|
-
__decorateClass$
|
|
5795
|
+
__decorateClass$s([
|
|
5795
5796
|
proxy$1()
|
|
5796
5797
|
], CanvasContext.prototype, "bezierCurveTo");
|
|
5797
|
-
__decorateClass$
|
|
5798
|
+
__decorateClass$s([
|
|
5798
5799
|
proxy$1()
|
|
5799
5800
|
], CanvasContext.prototype, "quadraticCurveTo");
|
|
5800
|
-
__decorateClass$
|
|
5801
|
+
__decorateClass$s([
|
|
5801
5802
|
proxy$1()
|
|
5802
5803
|
], CanvasContext.prototype, "ellipticalArc");
|
|
5803
|
-
__decorateClass$
|
|
5804
|
+
__decorateClass$s([
|
|
5804
5805
|
proxy$1()
|
|
5805
5806
|
], CanvasContext.prototype, "rect");
|
|
5806
|
-
__decorateClass$
|
|
5807
|
+
__decorateClass$s([
|
|
5807
5808
|
proxy$1()
|
|
5808
5809
|
], CanvasContext.prototype, "roundRect");
|
|
5809
|
-
__decorateClass$
|
|
5810
|
+
__decorateClass$s([
|
|
5810
5811
|
proxy$1()
|
|
5811
5812
|
], CanvasContext.prototype, "ellipse");
|
|
5812
|
-
__decorateClass$
|
|
5813
|
+
__decorateClass$s([
|
|
5813
5814
|
proxy$1()
|
|
5814
5815
|
], CanvasContext.prototype, "arc");
|
|
5815
|
-
__decorateClass$
|
|
5816
|
+
__decorateClass$s([
|
|
5816
5817
|
proxy$1()
|
|
5817
5818
|
], CanvasContext.prototype, "poly");
|
|
5818
|
-
__decorateClass$
|
|
5819
|
+
__decorateClass$s([
|
|
5819
5820
|
proxy$1()
|
|
5820
5821
|
], CanvasContext.prototype, "addShape");
|
|
5821
|
-
__decorateClass$
|
|
5822
|
+
__decorateClass$s([
|
|
5822
5823
|
proxy$1()
|
|
5823
5824
|
], CanvasContext.prototype, "addPath");
|
|
5824
|
-
__decorateClass$
|
|
5825
|
+
__decorateClass$s([
|
|
5825
5826
|
proxy$1()
|
|
5826
5827
|
], CanvasContext.prototype, "addSvgPath");
|
|
5827
|
-
__decorateClass$
|
|
5828
|
+
__decorateClass$s([
|
|
5828
5829
|
proxy$1()
|
|
5829
5830
|
], CanvasContext.prototype, "closePath");
|
|
5830
5831
|
|
|
@@ -6192,16 +6193,13 @@ class Style2DBackgroundModule extends Style2DModule {
|
|
|
6192
6193
|
install(Style2D) {
|
|
6193
6194
|
defineProperty(Style2D, "backgroundColor");
|
|
6194
6195
|
defineProperty(Style2D, "backgroundImage");
|
|
6195
|
-
Style2D.prototype.
|
|
6196
|
+
Style2D.prototype.getComputedBackgroundImage = getComputedBackgroundImage;
|
|
6196
6197
|
}
|
|
6197
6198
|
}
|
|
6198
|
-
async function
|
|
6199
|
+
async function getComputedBackgroundImage() {
|
|
6199
6200
|
if (this.backgroundImage) {
|
|
6200
6201
|
return await assets.texture.load(this.backgroundImage);
|
|
6201
6202
|
}
|
|
6202
|
-
if (this.backgroundColor) {
|
|
6203
|
-
return new ColorTexture(this.backgroundColor);
|
|
6204
|
-
}
|
|
6205
6203
|
}
|
|
6206
6204
|
|
|
6207
6205
|
class Style2DFilterModule extends Style2DModule {
|
|
@@ -6266,61 +6264,22 @@ function getComputedFilterColorMatrix() {
|
|
|
6266
6264
|
return m;
|
|
6267
6265
|
}
|
|
6268
6266
|
|
|
6269
|
-
class Style2DOffsetModule extends Style2DModule {
|
|
6270
|
-
install(Style2D) {
|
|
6271
|
-
defineProperty(Style2D, "offsetPath");
|
|
6272
|
-
defineProperty(Style2D, "offsetAnchor");
|
|
6273
|
-
defineProperty(Style2D, "offsetDistance");
|
|
6274
|
-
defineProperty(Style2D, "offsetPosition");
|
|
6275
|
-
Style2D.prototype.getComputedOffset = getComputedOffset;
|
|
6276
|
-
}
|
|
6277
|
-
}
|
|
6278
|
-
function getComputedOffset() {
|
|
6279
|
-
const offsetPath = this.offsetPath;
|
|
6280
|
-
if (!offsetPath)
|
|
6281
|
-
return;
|
|
6282
|
-
if (offsetPath.startsWith("path")) {
|
|
6283
|
-
const path = offsetPath.match(/path\(["'](.+)["']\)/)?.[1];
|
|
6284
|
-
if (!path)
|
|
6285
|
-
return;
|
|
6286
|
-
path.split(" ").forEach((arg) => {
|
|
6287
|
-
});
|
|
6288
|
-
} else if (offsetPath.startsWith("ray")) ; else if (offsetPath.startsWith("url")) ; else if (offsetPath.startsWith("circle")) ; else if (offsetPath.startsWith("ellipse")) ; else if (offsetPath.startsWith("insett")) ; else if (offsetPath.startsWith("polygon")) ; else if (offsetPath.startsWith("rect")) ; else if (offsetPath.startsWith("xywh")) ;
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
6267
|
class Style2DTextModule extends Style2DModule {
|
|
6292
6268
|
install(Style2D) {
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
defineProperty(Style2D, "fontStyle", { default: "normal" });
|
|
6298
|
-
defineProperty(Style2D, "fontKerning", { default: "normal" });
|
|
6299
|
-
defineProperty(Style2D, "textWrap", { default: "wrap" });
|
|
6300
|
-
defineProperty(Style2D, "textAlign", { default: "start" });
|
|
6301
|
-
defineProperty(Style2D, "verticalAlign", { default: "middle" });
|
|
6302
|
-
defineProperty(Style2D, "textTransform", { default: "none" });
|
|
6303
|
-
defineProperty(Style2D, "textDecoration", { default: null });
|
|
6304
|
-
defineProperty(Style2D, "textStrokeWidth", { default: 0 });
|
|
6305
|
-
defineProperty(Style2D, "textStrokeColor", { default: "#000000" });
|
|
6269
|
+
const style = modernIdoc.getDefaultTextStyle();
|
|
6270
|
+
for (const key in style) {
|
|
6271
|
+
defineProperty(Style2D, key, { default: style[key] });
|
|
6272
|
+
}
|
|
6306
6273
|
defineProperty(Style2D, "direction", { default: "inherit" });
|
|
6307
|
-
defineProperty(Style2D, "lineHeight", { default: 1 });
|
|
6308
|
-
defineProperty(Style2D, "letterSpacing", { default: 0 });
|
|
6309
|
-
defineProperty(Style2D, "writingMode", { default: "horizontal-tb" });
|
|
6310
6274
|
}
|
|
6311
6275
|
}
|
|
6312
6276
|
|
|
6313
6277
|
class Style2DTransformModule extends Style2DModule {
|
|
6314
6278
|
install(Style2D) {
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
defineProperty(Style2D, "rotate", { default: 0 });
|
|
6320
|
-
defineProperty(Style2D, "scaleX", { default: 1 });
|
|
6321
|
-
defineProperty(Style2D, "scaleY", { default: 1 });
|
|
6322
|
-
defineProperty(Style2D, "transform");
|
|
6323
|
-
defineProperty(Style2D, "transformOrigin", { default: "center" });
|
|
6279
|
+
const style = modernIdoc.getDefaultTransformStyle();
|
|
6280
|
+
for (const key in style) {
|
|
6281
|
+
defineProperty(Style2D, key, { default: style[key] });
|
|
6282
|
+
}
|
|
6324
6283
|
Style2D.prototype.getComputedTransform = getComputedTransform;
|
|
6325
6284
|
Style2D.prototype.getComputedTransformOrigin = getComputedTransformOrigin;
|
|
6326
6285
|
}
|
|
@@ -6329,7 +6288,11 @@ function getComputedTransform() {
|
|
|
6329
6288
|
const transform = new Transform2D();
|
|
6330
6289
|
const transform3d = new Transform2D(false);
|
|
6331
6290
|
const transform2d = new Transform2D(false).scale(this.scaleX, this.scaleY).translate(this.left, this.top).rotate(this.rotate * DEG_TO_RAD);
|
|
6332
|
-
|
|
6291
|
+
let _transform = this.transform;
|
|
6292
|
+
if (!_transform || _transform === "none") {
|
|
6293
|
+
_transform = "";
|
|
6294
|
+
}
|
|
6295
|
+
parseCssFunctions(_transform, { width: this.width, height: this.height }).forEach(({ name, args }) => {
|
|
6333
6296
|
const values = args.map((arg) => arg.normalizedIntValue);
|
|
6334
6297
|
transform.identity();
|
|
6335
6298
|
switch (name) {
|
|
@@ -6440,22 +6403,13 @@ function getComputedTransformOrigin() {
|
|
|
6440
6403
|
});
|
|
6441
6404
|
}
|
|
6442
6405
|
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
Style2DBackgroundModule: Style2DBackgroundModule,
|
|
6446
|
-
Style2DFilterModule: Style2DFilterModule,
|
|
6447
|
-
Style2DOffsetModule: Style2DOffsetModule,
|
|
6448
|
-
Style2DTextModule: Style2DTextModule,
|
|
6449
|
-
Style2DTransformModule: Style2DTransformModule
|
|
6450
|
-
};
|
|
6451
|
-
|
|
6452
|
-
var __defProp$s = Object.defineProperty;
|
|
6453
|
-
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
6406
|
+
var __defProp$r = Object.defineProperty;
|
|
6407
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
6454
6408
|
var result = void 0 ;
|
|
6455
6409
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6456
6410
|
if (decorator = decorators[i])
|
|
6457
6411
|
result = (decorator(target, key, result) ) || result;
|
|
6458
|
-
if (result) __defProp$
|
|
6412
|
+
if (result) __defProp$r(target, key, result);
|
|
6459
6413
|
return result;
|
|
6460
6414
|
};
|
|
6461
6415
|
class Style2D extends _Object {
|
|
@@ -6481,39 +6435,44 @@ class Style2D extends _Object {
|
|
|
6481
6435
|
}
|
|
6482
6436
|
}
|
|
6483
6437
|
}
|
|
6484
|
-
__decorateClass$
|
|
6438
|
+
__decorateClass$r([
|
|
6485
6439
|
property({ default: "#000000" })
|
|
6486
6440
|
], Style2D.prototype, "shadowColor");
|
|
6487
|
-
__decorateClass$
|
|
6441
|
+
__decorateClass$r([
|
|
6488
6442
|
property({ default: 0 })
|
|
6489
6443
|
], Style2D.prototype, "shadowOffsetX");
|
|
6490
|
-
__decorateClass$
|
|
6444
|
+
__decorateClass$r([
|
|
6491
6445
|
property({ default: 0 })
|
|
6492
6446
|
], Style2D.prototype, "shadowOffsetY");
|
|
6493
|
-
__decorateClass$
|
|
6447
|
+
__decorateClass$r([
|
|
6494
6448
|
property({ default: 0 })
|
|
6495
6449
|
], Style2D.prototype, "shadowBlur");
|
|
6496
|
-
__decorateClass$
|
|
6450
|
+
__decorateClass$r([
|
|
6497
6451
|
property({ default: 1 })
|
|
6498
6452
|
], Style2D.prototype, "opacity");
|
|
6499
|
-
__decorateClass$
|
|
6453
|
+
__decorateClass$r([
|
|
6500
6454
|
property({ default: 0 })
|
|
6501
6455
|
], Style2D.prototype, "borderRadius");
|
|
6502
|
-
__decorateClass$
|
|
6456
|
+
__decorateClass$r([
|
|
6503
6457
|
property({ default: "visible" })
|
|
6504
6458
|
], Style2D.prototype, "overflow");
|
|
6505
|
-
|
|
6459
|
+
[
|
|
6460
|
+
Style2DBackgroundModule,
|
|
6461
|
+
Style2DFilterModule,
|
|
6462
|
+
Style2DTextModule,
|
|
6463
|
+
Style2DTransformModule
|
|
6464
|
+
].forEach((Module) => {
|
|
6506
6465
|
new Module().install(Style2D);
|
|
6507
6466
|
});
|
|
6508
6467
|
|
|
6509
|
-
var __defProp$
|
|
6510
|
-
var __getOwnPropDesc$
|
|
6511
|
-
var __decorateClass$
|
|
6512
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6468
|
+
var __defProp$q = Object.defineProperty;
|
|
6469
|
+
var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
|
|
6470
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
6471
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
|
|
6513
6472
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6514
6473
|
if (decorator = decorators[i])
|
|
6515
6474
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6516
|
-
if (kind && result) __defProp$
|
|
6475
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
6517
6476
|
return result;
|
|
6518
6477
|
};
|
|
6519
6478
|
exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
@@ -6532,12 +6491,13 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6532
6491
|
_parentOpacity;
|
|
6533
6492
|
_tint = new Color(4294967295);
|
|
6534
6493
|
_backgroundColor = new Color(0);
|
|
6535
|
-
|
|
6494
|
+
_backgroundImage;
|
|
6495
|
+
// Batch render
|
|
6536
6496
|
context = new CanvasContext();
|
|
6537
6497
|
_resetContext = true;
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6498
|
+
_redrawing = false;
|
|
6499
|
+
_reflowing = false;
|
|
6500
|
+
_repainting = false;
|
|
6541
6501
|
_originalBatchables = [];
|
|
6542
6502
|
_layoutedBatchables = [];
|
|
6543
6503
|
_batchables = [];
|
|
@@ -6571,12 +6531,10 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6571
6531
|
_onUpdateStyleProperty(key, newValue, oldValue, declaration) {
|
|
6572
6532
|
switch (key) {
|
|
6573
6533
|
case "backgroundColor":
|
|
6574
|
-
this.
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
this.requestRedraw();
|
|
6579
|
-
}
|
|
6534
|
+
this._updateBackgroundColor();
|
|
6535
|
+
break;
|
|
6536
|
+
case "backgroundImage":
|
|
6537
|
+
this._updateBackgroundImage();
|
|
6580
6538
|
break;
|
|
6581
6539
|
case "opacity":
|
|
6582
6540
|
this._updateOpacity();
|
|
@@ -6584,8 +6542,23 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6584
6542
|
case "filter":
|
|
6585
6543
|
this.requestRepaint();
|
|
6586
6544
|
break;
|
|
6545
|
+
case "borderRadius":
|
|
6546
|
+
this.requestRedraw();
|
|
6547
|
+
break;
|
|
6587
6548
|
}
|
|
6588
6549
|
}
|
|
6550
|
+
_updateBackgroundColor() {
|
|
6551
|
+
this._backgroundColor.value = this.style.backgroundColor || 0;
|
|
6552
|
+
if (this._originalBatchables.length) {
|
|
6553
|
+
this.requestRepaint();
|
|
6554
|
+
} else if (this._backgroundColor.a > 0) {
|
|
6555
|
+
this.requestRedraw();
|
|
6556
|
+
}
|
|
6557
|
+
}
|
|
6558
|
+
async _updateBackgroundImage() {
|
|
6559
|
+
this._backgroundImage = await this.style.getComputedBackgroundImage();
|
|
6560
|
+
this.requestRedraw();
|
|
6561
|
+
}
|
|
6589
6562
|
_updateOpacity() {
|
|
6590
6563
|
const opacity = clamp(0, this.style.opacity, 1) * (this._parent?.opacity ?? 1);
|
|
6591
6564
|
if (this.opacity !== opacity) {
|
|
@@ -6597,13 +6570,13 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6597
6570
|
return this.opacity > 0 && super.isVisible();
|
|
6598
6571
|
}
|
|
6599
6572
|
requestRedraw() {
|
|
6600
|
-
this.
|
|
6573
|
+
this._redrawing = true;
|
|
6601
6574
|
}
|
|
6602
6575
|
requestReflow() {
|
|
6603
|
-
this.
|
|
6576
|
+
this._reflowing = true;
|
|
6604
6577
|
}
|
|
6605
6578
|
requestRepaint() {
|
|
6606
|
-
this.
|
|
6579
|
+
this._repainting = true;
|
|
6607
6580
|
}
|
|
6608
6581
|
_process(delta) {
|
|
6609
6582
|
const parentOpacity = this._parent?.opacity;
|
|
@@ -6614,6 +6587,30 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6614
6587
|
super._process(delta);
|
|
6615
6588
|
}
|
|
6616
6589
|
_draw() {
|
|
6590
|
+
this._drawBackground();
|
|
6591
|
+
this._drawContent();
|
|
6592
|
+
}
|
|
6593
|
+
_drawBackground() {
|
|
6594
|
+
const texture = this._backgroundImage;
|
|
6595
|
+
if (texture?.valid) {
|
|
6596
|
+
this.context.fillStyle = texture;
|
|
6597
|
+
this.context.textureTransform = new Transform2D().scale(
|
|
6598
|
+
this.style.width / texture.width,
|
|
6599
|
+
this.style.height / texture.height
|
|
6600
|
+
);
|
|
6601
|
+
this._fill();
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
_drawContent() {
|
|
6605
|
+
this._fill();
|
|
6606
|
+
}
|
|
6607
|
+
_fill() {
|
|
6608
|
+
if (this.style.borderRadius) {
|
|
6609
|
+
this.context.roundRect(0, 0, this.style.width, this.style.height, this.style.borderRadius);
|
|
6610
|
+
} else {
|
|
6611
|
+
this.context.rect(0, 0, this.style.width, this.style.height);
|
|
6612
|
+
}
|
|
6613
|
+
this.context.fill();
|
|
6617
6614
|
}
|
|
6618
6615
|
_relayout(batchables) {
|
|
6619
6616
|
return this._reflow(batchables);
|
|
@@ -6636,7 +6633,7 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6636
6633
|
}
|
|
6637
6634
|
_render(renderer) {
|
|
6638
6635
|
let batchables;
|
|
6639
|
-
if (this.
|
|
6636
|
+
if (this._redrawing) {
|
|
6640
6637
|
this._draw();
|
|
6641
6638
|
this._originalBatchables = this.context.toBatchables();
|
|
6642
6639
|
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
@@ -6644,17 +6641,17 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6644
6641
|
if (this._resetContext) {
|
|
6645
6642
|
this.context.reset();
|
|
6646
6643
|
}
|
|
6647
|
-
} else if (this.
|
|
6644
|
+
} else if (this._reflowing) {
|
|
6648
6645
|
this._layoutedBatchables = this._reflow(this._originalBatchables);
|
|
6649
6646
|
batchables = this._layoutedBatchables;
|
|
6650
|
-
} else if (this.
|
|
6647
|
+
} else if (this._repainting) {
|
|
6651
6648
|
batchables = this._repaint(this._layoutedBatchables);
|
|
6652
6649
|
}
|
|
6653
6650
|
if (batchables) {
|
|
6654
6651
|
this._batchables = batchables;
|
|
6655
|
-
this.
|
|
6656
|
-
this.
|
|
6657
|
-
this.
|
|
6652
|
+
this._redrawing = false;
|
|
6653
|
+
this._reflowing = false;
|
|
6654
|
+
this._repainting = false;
|
|
6658
6655
|
}
|
|
6659
6656
|
this._batchables.forEach((batchable) => {
|
|
6660
6657
|
batchable.texture?.upload(renderer);
|
|
@@ -6676,24 +6673,24 @@ exports.CanvasItem = class CanvasItem extends exports.Node {
|
|
|
6676
6673
|
};
|
|
6677
6674
|
}
|
|
6678
6675
|
};
|
|
6679
|
-
__decorateClass$
|
|
6676
|
+
__decorateClass$q([
|
|
6680
6677
|
property()
|
|
6681
6678
|
], exports.CanvasItem.prototype, "tint", 2);
|
|
6682
|
-
__decorateClass$
|
|
6679
|
+
__decorateClass$q([
|
|
6683
6680
|
property()
|
|
6684
6681
|
], exports.CanvasItem.prototype, "blendMode", 2);
|
|
6685
|
-
exports.CanvasItem = __decorateClass$
|
|
6682
|
+
exports.CanvasItem = __decorateClass$q([
|
|
6686
6683
|
customNode("CanvasItem")
|
|
6687
6684
|
], exports.CanvasItem);
|
|
6688
6685
|
|
|
6689
|
-
var __defProp$
|
|
6690
|
-
var __getOwnPropDesc$
|
|
6691
|
-
var __decorateClass$
|
|
6692
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6686
|
+
var __defProp$p = Object.defineProperty;
|
|
6687
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
6688
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
6689
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
6693
6690
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6694
6691
|
if (decorator = decorators[i])
|
|
6695
6692
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6696
|
-
if (kind && result) __defProp$
|
|
6693
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
6697
6694
|
return result;
|
|
6698
6695
|
};
|
|
6699
6696
|
const linear = (amount) => amount;
|
|
@@ -6760,8 +6757,8 @@ exports.Animation2D = class Animation2D extends exports.Node {
|
|
|
6760
6757
|
_startProps = /* @__PURE__ */ new WeakMap();
|
|
6761
6758
|
constructor(options) {
|
|
6762
6759
|
super();
|
|
6763
|
-
this.setProperties(options);
|
|
6764
6760
|
this._onUpdateTime = this._onUpdateTime.bind(this);
|
|
6761
|
+
this.setProperties(options);
|
|
6765
6762
|
}
|
|
6766
6763
|
_enterTree() {
|
|
6767
6764
|
this._tree?.timeline.on("update", this._onUpdateTime);
|
|
@@ -6980,36 +6977,36 @@ exports.Animation2D = class Animation2D extends exports.Node {
|
|
|
6980
6977
|
});
|
|
6981
6978
|
}
|
|
6982
6979
|
};
|
|
6983
|
-
__decorateClass$
|
|
6980
|
+
__decorateClass$p([
|
|
6984
6981
|
property({ default: "parent" })
|
|
6985
6982
|
], exports.Animation2D.prototype, "mode", 2);
|
|
6986
|
-
__decorateClass$
|
|
6983
|
+
__decorateClass$p([
|
|
6987
6984
|
property({ default: false })
|
|
6988
6985
|
], exports.Animation2D.prototype, "loop", 2);
|
|
6989
|
-
__decorateClass$
|
|
6986
|
+
__decorateClass$p([
|
|
6990
6987
|
property({ default: [] })
|
|
6991
6988
|
], exports.Animation2D.prototype, "keyframes", 2);
|
|
6992
|
-
__decorateClass$
|
|
6989
|
+
__decorateClass$p([
|
|
6993
6990
|
property()
|
|
6994
6991
|
], exports.Animation2D.prototype, "easing", 2);
|
|
6995
|
-
__decorateClass$
|
|
6992
|
+
__decorateClass$p([
|
|
6996
6993
|
property({ alias: "visibleDelay", default: 0 })
|
|
6997
6994
|
], exports.Animation2D.prototype, "delay", 2);
|
|
6998
|
-
__decorateClass$
|
|
6995
|
+
__decorateClass$p([
|
|
6999
6996
|
property({ alias: "visibleDuration", default: 2e3 })
|
|
7000
6997
|
], exports.Animation2D.prototype, "duration", 2);
|
|
7001
|
-
exports.Animation2D = __decorateClass$
|
|
6998
|
+
exports.Animation2D = __decorateClass$p([
|
|
7002
6999
|
customNode("Animation2D")
|
|
7003
7000
|
], exports.Animation2D);
|
|
7004
7001
|
|
|
7005
|
-
var __defProp$
|
|
7006
|
-
var __getOwnPropDesc$
|
|
7007
|
-
var __decorateClass$
|
|
7008
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7002
|
+
var __defProp$o = Object.defineProperty;
|
|
7003
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
7004
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
7005
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
7009
7006
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7010
7007
|
if (decorator = decorators[i])
|
|
7011
7008
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7012
|
-
if (kind && result) __defProp$
|
|
7009
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
7013
7010
|
return result;
|
|
7014
7011
|
};
|
|
7015
7012
|
exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
@@ -7055,6 +7052,9 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
7055
7052
|
case "transformOrigin":
|
|
7056
7053
|
this._updateTransform();
|
|
7057
7054
|
break;
|
|
7055
|
+
case "overflow":
|
|
7056
|
+
this._updateOverflow();
|
|
7057
|
+
break;
|
|
7058
7058
|
}
|
|
7059
7059
|
}
|
|
7060
7060
|
_updateTransform() {
|
|
@@ -7080,8 +7080,24 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
7080
7080
|
transform = t3dT2d;
|
|
7081
7081
|
}
|
|
7082
7082
|
this._transform.set(transform);
|
|
7083
|
+
this._updateOverflow();
|
|
7083
7084
|
this.requestReflow();
|
|
7084
7085
|
}
|
|
7086
|
+
_updateOverflow() {
|
|
7087
|
+
if (this.style.overflow === "hidden") {
|
|
7088
|
+
const [a, c, tx, b, d, ty] = this._transform.toArray();
|
|
7089
|
+
const width = this.style.width;
|
|
7090
|
+
const height = this.style.height;
|
|
7091
|
+
this.mask = {
|
|
7092
|
+
x: tx,
|
|
7093
|
+
y: ty,
|
|
7094
|
+
width: a * width + c * height,
|
|
7095
|
+
height: b * width + d * height
|
|
7096
|
+
};
|
|
7097
|
+
} else {
|
|
7098
|
+
this.mask = void 0;
|
|
7099
|
+
}
|
|
7100
|
+
}
|
|
7085
7101
|
_transformVertices(vertices) {
|
|
7086
7102
|
const [a, c, tx, b, d, ty] = this._transform.toArray();
|
|
7087
7103
|
const newVertices = vertices.slice();
|
|
@@ -7124,101 +7140,12 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
7124
7140
|
}
|
|
7125
7141
|
}
|
|
7126
7142
|
};
|
|
7127
|
-
exports.Node2D = __decorateClass$
|
|
7128
|
-
customNode("Node2D")
|
|
7129
|
-
], exports.Node2D);
|
|
7130
|
-
|
|
7131
|
-
var __defProp$o = Object.defineProperty;
|
|
7132
|
-
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
7133
|
-
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
7134
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
7135
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7136
|
-
if (decorator = decorators[i])
|
|
7137
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7138
|
-
if (kind && result) __defProp$o(target, key, result);
|
|
7139
|
-
return result;
|
|
7140
|
-
};
|
|
7141
|
-
exports.Element2D = class Element2D extends exports.Node2D {
|
|
7142
|
-
draggable;
|
|
7143
|
-
_background;
|
|
7144
|
-
constructor(options) {
|
|
7145
|
-
super();
|
|
7146
|
-
this.setProperties(options);
|
|
7147
|
-
}
|
|
7148
|
-
_onUpdateStyleProperty(key, value, oldValue) {
|
|
7149
|
-
super._onUpdateStyleProperty(key, value, oldValue);
|
|
7150
|
-
switch (key) {
|
|
7151
|
-
case "backgroundImage":
|
|
7152
|
-
this._updateBackground();
|
|
7153
|
-
break;
|
|
7154
|
-
case "borderRadius":
|
|
7155
|
-
this.requestRedraw();
|
|
7156
|
-
break;
|
|
7157
|
-
case "overflow":
|
|
7158
|
-
this._updateOverflow();
|
|
7159
|
-
break;
|
|
7160
|
-
}
|
|
7161
|
-
}
|
|
7162
|
-
async _updateBackground() {
|
|
7163
|
-
this._background = await this.style.getComputedBackground();
|
|
7164
|
-
this.requestRedraw();
|
|
7165
|
-
}
|
|
7166
|
-
_updateTransform() {
|
|
7167
|
-
super._updateTransform();
|
|
7168
|
-
this._updateOverflow();
|
|
7169
|
-
}
|
|
7170
|
-
_updateOverflow() {
|
|
7171
|
-
if (this.style.overflow === "hidden") {
|
|
7172
|
-
const [a, c, tx, b, d, ty] = this._transform.toArray();
|
|
7173
|
-
const width = this.style.width;
|
|
7174
|
-
const height = this.style.height;
|
|
7175
|
-
this.mask = {
|
|
7176
|
-
x: tx,
|
|
7177
|
-
y: ty,
|
|
7178
|
-
width: a * width + c * height,
|
|
7179
|
-
height: b * width + d * height
|
|
7180
|
-
};
|
|
7181
|
-
} else {
|
|
7182
|
-
this.mask = void 0;
|
|
7183
|
-
}
|
|
7184
|
-
}
|
|
7185
|
-
_draw() {
|
|
7186
|
-
super._draw();
|
|
7187
|
-
this._drawBackground();
|
|
7188
|
-
this._drawContent();
|
|
7189
|
-
}
|
|
7190
|
-
_drawBackground() {
|
|
7191
|
-
const texture = this._background;
|
|
7192
|
-
if (!texture?.valid)
|
|
7193
|
-
return;
|
|
7194
|
-
this.context.fillStyle = texture;
|
|
7195
|
-
this.context.textureTransform = new Transform2D().scale(
|
|
7196
|
-
this.style.width / texture.width,
|
|
7197
|
-
this.style.height / texture.height
|
|
7198
|
-
);
|
|
7199
|
-
this._drawRect();
|
|
7200
|
-
}
|
|
7201
|
-
_drawContent() {
|
|
7202
|
-
this._drawRect();
|
|
7203
|
-
}
|
|
7204
|
-
_drawRect() {
|
|
7205
|
-
if (this.style.borderRadius) {
|
|
7206
|
-
this.context.roundRect(0, 0, this.style.width, this.style.height, this.style.borderRadius);
|
|
7207
|
-
} else {
|
|
7208
|
-
this.context.rect(0, 0, this.style.width, this.style.height);
|
|
7209
|
-
}
|
|
7210
|
-
this.context.fill();
|
|
7211
|
-
}
|
|
7212
|
-
};
|
|
7213
|
-
__decorateClass$o([
|
|
7214
|
-
property()
|
|
7215
|
-
], exports.Element2D.prototype, "draggable", 2);
|
|
7216
|
-
exports.Element2D = __decorateClass$o([
|
|
7143
|
+
exports.Node2D = __decorateClass$o([
|
|
7217
7144
|
customNode({
|
|
7218
|
-
tag: "
|
|
7145
|
+
tag: "Node2D",
|
|
7219
7146
|
renderable: true
|
|
7220
7147
|
})
|
|
7221
|
-
], exports.
|
|
7148
|
+
], exports.Node2D);
|
|
7222
7149
|
|
|
7223
7150
|
var __defProp$n = Object.defineProperty;
|
|
7224
7151
|
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
@@ -7327,10 +7254,7 @@ __decorateClass$n([
|
|
|
7327
7254
|
proxy({ method: true, redraw: true })
|
|
7328
7255
|
], exports.Graphics2D.prototype, "stroke", 2);
|
|
7329
7256
|
exports.Graphics2D = __decorateClass$n([
|
|
7330
|
-
customNode(
|
|
7331
|
-
tag: "Graphics2D",
|
|
7332
|
-
renderable: true
|
|
7333
|
-
})
|
|
7257
|
+
customNode("Graphics2D")
|
|
7334
7258
|
], exports.Graphics2D);
|
|
7335
7259
|
|
|
7336
7260
|
class Image2DResource extends Resource {
|
|
@@ -7369,7 +7293,7 @@ var __decorateClass$m = (decorators, target, key, kind) => {
|
|
|
7369
7293
|
if (kind && result) __defProp$m(target, key, result);
|
|
7370
7294
|
return result;
|
|
7371
7295
|
};
|
|
7372
|
-
exports.Image2D = class Image2D extends exports.
|
|
7296
|
+
exports.Image2D = class Image2D extends exports.Node2D {
|
|
7373
7297
|
resource;
|
|
7374
7298
|
get currentTexture() {
|
|
7375
7299
|
return this.resource?.frames[this._frameIndex]?.texture;
|
|
@@ -7488,7 +7412,7 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
7488
7412
|
const texture = this.currentTexture;
|
|
7489
7413
|
return super._repaint(
|
|
7490
7414
|
batchables.map((batchable, i) => {
|
|
7491
|
-
if ((this.
|
|
7415
|
+
if ((this._backgroundImage ? i === 1 : i === 0) && batchable.type === "fill") {
|
|
7492
7416
|
return {
|
|
7493
7417
|
...batchable,
|
|
7494
7418
|
texture: texture?.valid ? texture : void 0
|
|
@@ -7522,7 +7446,7 @@ var __decorateClass$l = (decorators, target, key, kind) => {
|
|
|
7522
7446
|
if (kind && result) __defProp$l(target, key, result);
|
|
7523
7447
|
return result;
|
|
7524
7448
|
};
|
|
7525
|
-
exports.Lottie2D = class Lottie2D extends exports.
|
|
7449
|
+
exports.Lottie2D = class Lottie2D extends exports.Node2D {
|
|
7526
7450
|
duration = 0;
|
|
7527
7451
|
texture = new Texture(document.createElement("canvas"));
|
|
7528
7452
|
animation;
|
|
@@ -7594,8 +7518,11 @@ var __decorateClass$k = (decorators, target, key, kind) => {
|
|
|
7594
7518
|
return result;
|
|
7595
7519
|
};
|
|
7596
7520
|
const textStyles = new Set(Object.keys(modernText.textDefaultStyle));
|
|
7597
|
-
exports.Text2D = class Text2D extends exports.
|
|
7521
|
+
exports.Text2D = class Text2D extends exports.Node2D {
|
|
7598
7522
|
effects;
|
|
7523
|
+
measureDom;
|
|
7524
|
+
fonts;
|
|
7525
|
+
text = new modernText.Text();
|
|
7599
7526
|
texture = new Texture(document.createElement("canvas"));
|
|
7600
7527
|
_subTextsCount = 0;
|
|
7601
7528
|
constructor(options) {
|
|
@@ -7606,6 +7533,8 @@ exports.Text2D = class Text2D extends exports.Element2D {
|
|
|
7606
7533
|
super._onUpdateProperty(key, value, oldValue);
|
|
7607
7534
|
switch (key) {
|
|
7608
7535
|
case "content":
|
|
7536
|
+
case "effects":
|
|
7537
|
+
case "fonts":
|
|
7609
7538
|
case "split":
|
|
7610
7539
|
this._updateSplit();
|
|
7611
7540
|
this.requestRedraw();
|
|
@@ -7617,6 +7546,13 @@ exports.Text2D = class Text2D extends exports.Element2D {
|
|
|
7617
7546
|
});
|
|
7618
7547
|
}
|
|
7619
7548
|
}
|
|
7549
|
+
_updateText() {
|
|
7550
|
+
this.text.style = this.style.toJSON();
|
|
7551
|
+
this.text.content = this.content ?? "";
|
|
7552
|
+
this.text.effects = this.effects;
|
|
7553
|
+
this.text.fonts = this.fonts;
|
|
7554
|
+
this.text.measureDom = this.measureDom;
|
|
7555
|
+
}
|
|
7620
7556
|
_onUpdateStyleProperty(key, value, oldValue) {
|
|
7621
7557
|
if (key === "height")
|
|
7622
7558
|
return;
|
|
@@ -7660,13 +7596,8 @@ exports.Text2D = class Text2D extends exports.Element2D {
|
|
|
7660
7596
|
}
|
|
7661
7597
|
}
|
|
7662
7598
|
measure() {
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
style: {
|
|
7666
|
-
...this.style.toJSON(),
|
|
7667
|
-
height: void 0
|
|
7668
|
-
}
|
|
7669
|
-
});
|
|
7599
|
+
this._updateText();
|
|
7600
|
+
const result = this.text.measure();
|
|
7670
7601
|
if (!this.style.width)
|
|
7671
7602
|
this.style.width = result.boundingBox.width;
|
|
7672
7603
|
if (!this.style.height)
|
|
@@ -7710,12 +7641,10 @@ exports.Text2D = class Text2D extends exports.Element2D {
|
|
|
7710
7641
|
if (onText2DRender) {
|
|
7711
7642
|
onText2DRender();
|
|
7712
7643
|
} else {
|
|
7713
|
-
|
|
7714
|
-
|
|
7644
|
+
this._updateText();
|
|
7645
|
+
this.text.render({
|
|
7715
7646
|
pixelRatio: this.pixelRatio,
|
|
7716
|
-
|
|
7717
|
-
effects: this.effects,
|
|
7718
|
-
style: this.style.toJSON()
|
|
7647
|
+
view: this.texture.source
|
|
7719
7648
|
});
|
|
7720
7649
|
}
|
|
7721
7650
|
this.texture.requestUpload();
|
|
@@ -7740,6 +7669,12 @@ __decorateClass$k([
|
|
|
7740
7669
|
__decorateClass$k([
|
|
7741
7670
|
property()
|
|
7742
7671
|
], exports.Text2D.prototype, "effects", 2);
|
|
7672
|
+
__decorateClass$k([
|
|
7673
|
+
protectedProperty()
|
|
7674
|
+
], exports.Text2D.prototype, "measureDom", 2);
|
|
7675
|
+
__decorateClass$k([
|
|
7676
|
+
protectedProperty()
|
|
7677
|
+
], exports.Text2D.prototype, "fonts", 2);
|
|
7743
7678
|
exports.Text2D = __decorateClass$k([
|
|
7744
7679
|
customNode("Text2D")
|
|
7745
7680
|
], exports.Text2D);
|
|
@@ -7754,7 +7689,7 @@ var __decorateClass$j = (decorators, target, key, kind) => {
|
|
|
7754
7689
|
if (kind && result) __defProp$j(target, key, result);
|
|
7755
7690
|
return result;
|
|
7756
7691
|
};
|
|
7757
|
-
exports.Video2D = class Video2D extends exports.
|
|
7692
|
+
exports.Video2D = class Video2D extends exports.Node2D {
|
|
7758
7693
|
texture;
|
|
7759
7694
|
get duration() {
|
|
7760
7695
|
return (this.texture?.duration ?? 0) * 1e3;
|
|
@@ -8920,7 +8855,7 @@ exports.Audio = __decorateClass$i([
|
|
|
8920
8855
|
customNode("Audio")
|
|
8921
8856
|
], exports.Audio);
|
|
8922
8857
|
|
|
8923
|
-
class AudioSpectrum extends exports.
|
|
8858
|
+
class AudioSpectrum extends exports.Node2D {
|
|
8924
8859
|
//
|
|
8925
8860
|
}
|
|
8926
8861
|
|
|
@@ -8934,7 +8869,7 @@ var __decorateClass$h = (decorators, target, key, kind) => {
|
|
|
8934
8869
|
if (kind && result) __defProp$h(target, key, result);
|
|
8935
8870
|
return result;
|
|
8936
8871
|
};
|
|
8937
|
-
exports.AudioWaveform = class AudioWaveform extends exports.
|
|
8872
|
+
exports.AudioWaveform = class AudioWaveform extends exports.Node2D {
|
|
8938
8873
|
src;
|
|
8939
8874
|
gap = 0;
|
|
8940
8875
|
color = "#000000";
|
|
@@ -13763,7 +13698,8 @@ class Engine extends SceneTree {
|
|
|
13763
13698
|
} else {
|
|
13764
13699
|
this.resize(
|
|
13765
13700
|
width || this.gl.drawingBufferWidth || this.view?.clientWidth || 200,
|
|
13766
|
-
height || this.gl.drawingBufferHeight || this.view?.clientHeight || 200
|
|
13701
|
+
height || this.gl.drawingBufferHeight || this.view?.clientHeight || 200,
|
|
13702
|
+
!view
|
|
13767
13703
|
);
|
|
13768
13704
|
}
|
|
13769
13705
|
}
|
|
@@ -13974,7 +13910,6 @@ exports.Style2D = Style2D;
|
|
|
13974
13910
|
exports.Style2DBackgroundModule = Style2DBackgroundModule;
|
|
13975
13911
|
exports.Style2DFilterModule = Style2DFilterModule;
|
|
13976
13912
|
exports.Style2DModule = Style2DModule;
|
|
13977
|
-
exports.Style2DOffsetModule = Style2DOffsetModule;
|
|
13978
13913
|
exports.Style2DTextModule = Style2DTextModule;
|
|
13979
13914
|
exports.Style2DTransformModule = Style2DTransformModule;
|
|
13980
13915
|
exports.TextLoader = TextLoader;
|