modern-canvas 0.4.38 → 0.4.39
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 +38 -22
- package/dist/index.js +3 -3
- package/dist/index.mjs +38 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2496,25 +2496,23 @@ class Transform2D extends Matrix3 {
|
|
|
2496
2496
|
return t2d.multiply(this, this);
|
|
2497
2497
|
}
|
|
2498
2498
|
skewX(x) {
|
|
2499
|
-
return this.skew(x,
|
|
2499
|
+
return this.skew(x, 0);
|
|
2500
2500
|
}
|
|
2501
2501
|
skewY(y) {
|
|
2502
|
-
return this.skew(
|
|
2502
|
+
return this.skew(0, y);
|
|
2503
2503
|
}
|
|
2504
2504
|
skew(x, y) {
|
|
2505
2505
|
return this.premultiply(Transform2D._t2d.makeSkew(x, y));
|
|
2506
2506
|
}
|
|
2507
2507
|
makeSkew(x, y) {
|
|
2508
|
-
const
|
|
2509
|
-
const
|
|
2510
|
-
const cy = -Math.sin(-x);
|
|
2511
|
-
const sy = Math.cos(-x);
|
|
2508
|
+
const tanX = Math.tan(x);
|
|
2509
|
+
const tanY = Math.tan(y);
|
|
2512
2510
|
this.set([
|
|
2513
|
-
|
|
2514
|
-
|
|
2511
|
+
1,
|
|
2512
|
+
tanY,
|
|
2515
2513
|
0,
|
|
2516
|
-
|
|
2517
|
-
|
|
2514
|
+
tanX,
|
|
2515
|
+
1,
|
|
2518
2516
|
0,
|
|
2519
2517
|
0,
|
|
2520
2518
|
0,
|
|
@@ -6453,15 +6451,27 @@ exports.Node = class Node extends CoreObject {
|
|
|
6453
6451
|
if (this.is(node) || node.hasParent()) {
|
|
6454
6452
|
return node;
|
|
6455
6453
|
}
|
|
6454
|
+
let index = -1;
|
|
6456
6455
|
switch (internalMode) {
|
|
6457
6456
|
case "default":
|
|
6457
|
+
index = this._children.findLastIndex((node2) => node2.internalMode === "default");
|
|
6458
|
+
if (index > -1) {
|
|
6459
|
+
index += 1;
|
|
6460
|
+
} else {
|
|
6461
|
+
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
6462
|
+
}
|
|
6463
|
+
break;
|
|
6458
6464
|
case "front": {
|
|
6459
|
-
|
|
6460
|
-
const index = this._children.findIndex((node2) => node2.internalMode === targetMode);
|
|
6465
|
+
index = this._children.findLastIndex((node2) => node2.internalMode === "front");
|
|
6461
6466
|
if (index > -1) {
|
|
6462
|
-
|
|
6467
|
+
index += 1;
|
|
6463
6468
|
} else {
|
|
6464
|
-
this._children.
|
|
6469
|
+
index = this._children.findIndex((node2) => node2.internalMode === "default");
|
|
6470
|
+
}
|
|
6471
|
+
if (index > -1) {
|
|
6472
|
+
index += 1;
|
|
6473
|
+
} else {
|
|
6474
|
+
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
6465
6475
|
}
|
|
6466
6476
|
break;
|
|
6467
6477
|
}
|
|
@@ -6469,6 +6479,11 @@ exports.Node = class Node extends CoreObject {
|
|
|
6469
6479
|
this._children.push(node);
|
|
6470
6480
|
break;
|
|
6471
6481
|
}
|
|
6482
|
+
if (index > -1) {
|
|
6483
|
+
this._children.splice(index, 0, node);
|
|
6484
|
+
} else {
|
|
6485
|
+
this._children.push(node);
|
|
6486
|
+
}
|
|
6472
6487
|
node.internalMode = internalMode;
|
|
6473
6488
|
node.setParent(this);
|
|
6474
6489
|
this.emit("appendChild", node);
|
|
@@ -11231,22 +11246,23 @@ exports.Text2D = class Text2D extends TextureRect2D {
|
|
|
11231
11246
|
this._subTextsCount = 0;
|
|
11232
11247
|
}
|
|
11233
11248
|
if (this.split) {
|
|
11234
|
-
this.
|
|
11249
|
+
this.measure().paragraphs.forEach((p) => {
|
|
11235
11250
|
p.fragments.forEach((f) => {
|
|
11236
11251
|
f.characters.forEach((c) => {
|
|
11237
|
-
this.
|
|
11252
|
+
this.append(
|
|
11238
11253
|
new exports.Text2D({
|
|
11239
|
-
|
|
11254
|
+
internalMode: "front",
|
|
11240
11255
|
style: {
|
|
11241
11256
|
...c.computedStyle,
|
|
11242
11257
|
left: c.inlineBox.x,
|
|
11243
11258
|
top: c.inlineBox.y,
|
|
11244
11259
|
width: 0,
|
|
11245
|
-
height: 0
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11260
|
+
height: 0
|
|
11261
|
+
},
|
|
11262
|
+
content: c.content,
|
|
11263
|
+
effects: this.effects,
|
|
11264
|
+
fonts: this.fonts
|
|
11265
|
+
})
|
|
11250
11266
|
);
|
|
11251
11267
|
this._subTextsCount++;
|
|
11252
11268
|
});
|