modern-canvas 0.4.38 → 0.4.40
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 -25
- package/dist/index.js +3 -3
- package/dist/index.mjs +38 -25
- 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
|
-
|
|
6465
|
+
index = this._children.findLastIndex((node2) => node2.internalMode === "front");
|
|
6466
|
+
if (index > -1) {
|
|
6467
|
+
index += 1;
|
|
6468
|
+
} else {
|
|
6469
|
+
index = this._children.findIndex((node2) => node2.internalMode === "default");
|
|
6470
|
+
}
|
|
6461
6471
|
if (index > -1) {
|
|
6462
|
-
|
|
6472
|
+
index += 1;
|
|
6463
6473
|
} else {
|
|
6464
|
-
this._children.
|
|
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);
|
|
@@ -11118,9 +11133,6 @@ var __decorateClass$g = (decorators, target, key, kind) => {
|
|
|
11118
11133
|
};
|
|
11119
11134
|
const textStyles = new Set(Object.keys(modernText.textDefaultStyle));
|
|
11120
11135
|
exports.Text2D = class Text2D extends TextureRect2D {
|
|
11121
|
-
effects;
|
|
11122
|
-
measureDom;
|
|
11123
|
-
fonts;
|
|
11124
11136
|
texture = new CanvasTexture();
|
|
11125
11137
|
base = new modernText.Text();
|
|
11126
11138
|
measureResult;
|
|
@@ -11231,22 +11243,23 @@ exports.Text2D = class Text2D extends TextureRect2D {
|
|
|
11231
11243
|
this._subTextsCount = 0;
|
|
11232
11244
|
}
|
|
11233
11245
|
if (this.split) {
|
|
11234
|
-
this.
|
|
11246
|
+
this.measure().paragraphs.forEach((p) => {
|
|
11235
11247
|
p.fragments.forEach((f) => {
|
|
11236
11248
|
f.characters.forEach((c) => {
|
|
11237
|
-
this.
|
|
11249
|
+
this.append(
|
|
11238
11250
|
new exports.Text2D({
|
|
11239
|
-
|
|
11251
|
+
internalMode: "front",
|
|
11240
11252
|
style: {
|
|
11241
11253
|
...c.computedStyle,
|
|
11242
11254
|
left: c.inlineBox.x,
|
|
11243
11255
|
top: c.inlineBox.y,
|
|
11244
11256
|
width: 0,
|
|
11245
|
-
height: 0
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11257
|
+
height: 0
|
|
11258
|
+
},
|
|
11259
|
+
content: c.content,
|
|
11260
|
+
effects: this.effects,
|
|
11261
|
+
fonts: this.fonts
|
|
11262
|
+
})
|
|
11250
11263
|
);
|
|
11251
11264
|
this._subTextsCount++;
|
|
11252
11265
|
});
|