modern-canvas 0.4.38 → 0.4.40-patch.1
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 +39 -26
- package/dist/index.js +3 -3
- package/dist/index.mjs +39 -26
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2490,25 +2490,23 @@ class Transform2D extends Matrix3 {
|
|
|
2490
2490
|
return t2d.multiply(this, this);
|
|
2491
2491
|
}
|
|
2492
2492
|
skewX(x) {
|
|
2493
|
-
return this.skew(x,
|
|
2493
|
+
return this.skew(x, 0);
|
|
2494
2494
|
}
|
|
2495
2495
|
skewY(y) {
|
|
2496
|
-
return this.skew(
|
|
2496
|
+
return this.skew(0, y);
|
|
2497
2497
|
}
|
|
2498
2498
|
skew(x, y) {
|
|
2499
2499
|
return this.premultiply(Transform2D._t2d.makeSkew(x, y));
|
|
2500
2500
|
}
|
|
2501
2501
|
makeSkew(x, y) {
|
|
2502
|
-
const
|
|
2503
|
-
const
|
|
2504
|
-
const cy = -Math.sin(-x);
|
|
2505
|
-
const sy = Math.cos(-x);
|
|
2502
|
+
const tanX = Math.tan(x);
|
|
2503
|
+
const tanY = Math.tan(y);
|
|
2506
2504
|
this.set([
|
|
2507
|
-
|
|
2508
|
-
|
|
2505
|
+
1,
|
|
2506
|
+
tanY,
|
|
2509
2507
|
0,
|
|
2510
|
-
|
|
2511
|
-
|
|
2508
|
+
tanX,
|
|
2509
|
+
1,
|
|
2512
2510
|
0,
|
|
2513
2511
|
0,
|
|
2514
2512
|
0,
|
|
@@ -6447,15 +6445,27 @@ let Node = class extends CoreObject {
|
|
|
6447
6445
|
if (this.is(node) || node.hasParent()) {
|
|
6448
6446
|
return node;
|
|
6449
6447
|
}
|
|
6448
|
+
let index = -1;
|
|
6450
6449
|
switch (internalMode) {
|
|
6451
6450
|
case "default":
|
|
6451
|
+
index = this._children.findLastIndex((node2) => node2.internalMode === "default");
|
|
6452
|
+
if (index > -1) {
|
|
6453
|
+
index += 1;
|
|
6454
|
+
} else {
|
|
6455
|
+
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
6456
|
+
}
|
|
6457
|
+
break;
|
|
6452
6458
|
case "front": {
|
|
6453
|
-
|
|
6454
|
-
|
|
6459
|
+
index = this._children.findLastIndex((node2) => node2.internalMode === "front");
|
|
6460
|
+
if (index > -1) {
|
|
6461
|
+
index += 1;
|
|
6462
|
+
} else {
|
|
6463
|
+
index = this._children.findIndex((node2) => node2.internalMode === "default");
|
|
6464
|
+
}
|
|
6455
6465
|
if (index > -1) {
|
|
6456
|
-
|
|
6466
|
+
index += 1;
|
|
6457
6467
|
} else {
|
|
6458
|
-
this._children.
|
|
6468
|
+
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
6459
6469
|
}
|
|
6460
6470
|
break;
|
|
6461
6471
|
}
|
|
@@ -6463,6 +6473,11 @@ let Node = class extends CoreObject {
|
|
|
6463
6473
|
this._children.push(node);
|
|
6464
6474
|
break;
|
|
6465
6475
|
}
|
|
6476
|
+
if (index > -1) {
|
|
6477
|
+
this._children.splice(index, 0, node);
|
|
6478
|
+
} else {
|
|
6479
|
+
this._children.push(node);
|
|
6480
|
+
}
|
|
6466
6481
|
node.internalMode = internalMode;
|
|
6467
6482
|
node.setParent(this);
|
|
6468
6483
|
this.emit("appendChild", node);
|
|
@@ -11112,9 +11127,6 @@ var __decorateClass$g = (decorators, target, key, kind) => {
|
|
|
11112
11127
|
};
|
|
11113
11128
|
const textStyles = new Set(Object.keys(textDefaultStyle));
|
|
11114
11129
|
let Text2D = class extends TextureRect2D {
|
|
11115
|
-
effects;
|
|
11116
|
-
measureDom;
|
|
11117
|
-
fonts;
|
|
11118
11130
|
texture = new CanvasTexture();
|
|
11119
11131
|
base = new Text();
|
|
11120
11132
|
measureResult;
|
|
@@ -11225,22 +11237,23 @@ let Text2D = class extends TextureRect2D {
|
|
|
11225
11237
|
this._subTextsCount = 0;
|
|
11226
11238
|
}
|
|
11227
11239
|
if (this.split) {
|
|
11228
|
-
this.
|
|
11240
|
+
this.measure().paragraphs.forEach((p) => {
|
|
11229
11241
|
p.fragments.forEach((f) => {
|
|
11230
11242
|
f.characters.forEach((c) => {
|
|
11231
|
-
this.
|
|
11243
|
+
this.append(
|
|
11232
11244
|
new Text2D({
|
|
11233
|
-
|
|
11245
|
+
internalMode: "front",
|
|
11234
11246
|
style: {
|
|
11235
11247
|
...c.computedStyle,
|
|
11236
11248
|
left: c.inlineBox.x,
|
|
11237
11249
|
top: c.inlineBox.y,
|
|
11238
|
-
width:
|
|
11239
|
-
height:
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11250
|
+
width: c.inlineBox.width,
|
|
11251
|
+
height: c.inlineBox.height
|
|
11252
|
+
},
|
|
11253
|
+
content: c.content,
|
|
11254
|
+
effects: this.effects,
|
|
11255
|
+
fonts: this.fonts
|
|
11256
|
+
})
|
|
11244
11257
|
);
|
|
11245
11258
|
this._subTextsCount++;
|
|
11246
11259
|
});
|