@mlightcad/mtext-renderer 0.10.10 → 0.10.12
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.js +69 -56
- package/dist/index.umd.cjs +6 -6
- package/dist/mtext-renderer-worker.js +80 -68
- package/lib/index.d.ts +1 -0
- package/lib/renderer/mtextProcessor.d.ts +9 -0
- package/lib/shxParser.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10297,7 +10297,7 @@ class rl {
|
|
|
10297
10297
|
}
|
|
10298
10298
|
}
|
|
10299
10299
|
}
|
|
10300
|
-
class
|
|
10300
|
+
class re {
|
|
10301
10301
|
/**
|
|
10302
10302
|
* Creates a new Point instance.
|
|
10303
10303
|
* @param x - The x-coordinate (defaults to 0)
|
|
@@ -10335,7 +10335,7 @@ class te {
|
|
|
10335
10335
|
* @returns A new Point instance with the same x and y values
|
|
10336
10336
|
*/
|
|
10337
10337
|
clone() {
|
|
10338
|
-
return new
|
|
10338
|
+
return new re(this.x, this.y);
|
|
10339
10339
|
}
|
|
10340
10340
|
/**
|
|
10341
10341
|
* Adds another point's coordinates to this point.
|
|
@@ -10440,18 +10440,18 @@ class Bt {
|
|
|
10440
10440
|
}
|
|
10441
10441
|
const a = 4 * Math.atan(Math.abs(this.bulge));
|
|
10442
10442
|
this.radius = n / (2 * Math.sin(a / 2));
|
|
10443
|
-
const i = this.start.clone().add(r.clone().divide(2)), s = new
|
|
10443
|
+
const i = this.start.clone().add(r.clone().divide(2)), s = new re(-r.y, r.x);
|
|
10444
10444
|
s.normalize(), s.multiply(Math.abs(this.radius * Math.cos(a / 2))), this.center = i.clone(), this.isClockwise ? this.center.subtract(s) : this.center.add(s), this.startAngle = Math.atan2(this.start.y - this.center.y, this.start.x - this.center.x), this.endAngle = Math.atan2(this.end.y - this.center.y, this.end.x - this.center.x), this.isClockwise ? this.endAngle >= this.startAngle && (this.endAngle -= 2 * Math.PI) : this.endAngle <= this.startAngle && (this.endAngle += 2 * Math.PI);
|
|
10445
10445
|
} else if (e.center && e.radius !== void 0 && e.startOctant !== void 0 && e.octantCount !== void 0 && e.isClockwise !== void 0) {
|
|
10446
10446
|
this.center = e.center.clone(), this.radius = e.radius, this.isClockwise = e.isClockwise, this.startAngle = e.startOctant * Ta;
|
|
10447
10447
|
const r = (e.octantCount === 0 ? 8 : e.octantCount) * Ta;
|
|
10448
10448
|
this.endAngle = this.startAngle + (this.isClockwise ? -r : r), this.start = this.center.clone().add(
|
|
10449
|
-
new
|
|
10449
|
+
new re(
|
|
10450
10450
|
this.radius * Math.cos(this.startAngle),
|
|
10451
10451
|
this.radius * Math.sin(this.startAngle)
|
|
10452
10452
|
)
|
|
10453
10453
|
), this.end = this.center.clone().add(
|
|
10454
|
-
new
|
|
10454
|
+
new re(this.radius * Math.cos(this.endAngle), this.radius * Math.sin(this.endAngle))
|
|
10455
10455
|
);
|
|
10456
10456
|
} else
|
|
10457
10457
|
throw new Error("Invalid arc parameters");
|
|
@@ -10468,12 +10468,12 @@ class Bt {
|
|
|
10468
10468
|
for (let i = 1; i < a; i++) {
|
|
10469
10469
|
const s = i / a, o = this.isClockwise ? this.startAngle - s * n : this.startAngle + s * n;
|
|
10470
10470
|
r.push(
|
|
10471
|
-
this.center.clone().add(new
|
|
10471
|
+
this.center.clone().add(new re(this.radius * Math.cos(o), this.radius * Math.sin(o)))
|
|
10472
10472
|
);
|
|
10473
10473
|
}
|
|
10474
10474
|
return r.push(
|
|
10475
10475
|
this.end ? this.end.clone() : this.center.clone().add(
|
|
10476
|
-
new
|
|
10476
|
+
new re(
|
|
10477
10477
|
this.radius * Math.cos(this.endAngle),
|
|
10478
10478
|
this.radius * Math.sin(this.endAngle)
|
|
10479
10479
|
)
|
|
@@ -10520,7 +10520,7 @@ class Tt {
|
|
|
10520
10520
|
*/
|
|
10521
10521
|
normalizeToOrigin(e = !1) {
|
|
10522
10522
|
const r = this.bbox;
|
|
10523
|
-
return this.offset(new
|
|
10523
|
+
return this.offset(new re(-r.minX, -r.minY), e);
|
|
10524
10524
|
}
|
|
10525
10525
|
/**
|
|
10526
10526
|
* Converts the shape to an SVG string
|
|
@@ -10639,7 +10639,7 @@ class al {
|
|
|
10639
10639
|
*/
|
|
10640
10640
|
parseShape(e) {
|
|
10641
10641
|
const r = {
|
|
10642
|
-
currentPoint: new
|
|
10642
|
+
currentPoint: new re(),
|
|
10643
10643
|
polylines: [],
|
|
10644
10644
|
currentPolyline: [],
|
|
10645
10645
|
sp: [],
|
|
@@ -10725,7 +10725,7 @@ class al {
|
|
|
10725
10725
|
* @returns Returns the vector for the given direction code
|
|
10726
10726
|
*/
|
|
10727
10727
|
getVectorForDirection(e) {
|
|
10728
|
-
const r = new
|
|
10728
|
+
const r = new re();
|
|
10729
10729
|
switch (e) {
|
|
10730
10730
|
case 0:
|
|
10731
10731
|
r.x = 1;
|
|
@@ -10796,13 +10796,13 @@ class al {
|
|
|
10796
10796
|
}
|
|
10797
10797
|
handleXYDisplacement(e, r, n) {
|
|
10798
10798
|
let a = r;
|
|
10799
|
-
const i = new
|
|
10799
|
+
const i = new re();
|
|
10800
10800
|
return i.x = ge.byteToSByte(e[++a]), i.y = ge.byteToSByte(e[++a]), n.currentPoint.add(i.multiply(n.scale)), n.isPenDown && n.currentPolyline.push(n.currentPoint.clone()), a;
|
|
10801
10801
|
}
|
|
10802
10802
|
handleMultipleXYDisplacements(e, r, n) {
|
|
10803
10803
|
let a = r;
|
|
10804
10804
|
for (; ; ) {
|
|
10805
|
-
const i = new
|
|
10805
|
+
const i = new re();
|
|
10806
10806
|
if (i.x = ge.byteToSByte(e[++a]), i.y = ge.byteToSByte(e[++a]), i.x === 0 && i.y === 0)
|
|
10807
10807
|
break;
|
|
10808
10808
|
n.currentPoint.add(i.multiply(n.scale)), n.isPenDown && n.currentPolyline.push(n.currentPoint.clone());
|
|
@@ -10814,7 +10814,7 @@ class al {
|
|
|
10814
10814
|
let i = r;
|
|
10815
10815
|
const s = e[++i] * n.scale, o = ge.byteToSByte(e[++i]), c = (o & 112) >> 4;
|
|
10816
10816
|
let u = o & 7;
|
|
10817
|
-
const h = o < 0, p = Math.PI / 4 * c, l = n.currentPoint.clone().subtract(new
|
|
10817
|
+
const h = o < 0, p = Math.PI / 4 * c, l = n.currentPoint.clone().subtract(new re(Math.cos(p) * s, Math.sin(p) * s)), g = Bt.fromOctant(l, s, c, u, h);
|
|
10818
10818
|
if (n.isPenDown) {
|
|
10819
10819
|
const x = g.tessellate();
|
|
10820
10820
|
n.currentPolyline.pop(), n.currentPolyline.push(...x.slice());
|
|
@@ -10831,29 +10831,29 @@ class al {
|
|
|
10831
10831
|
h < 0 && (v = -v, x = -x, b = -1);
|
|
10832
10832
|
let m = g * p, F = m + x;
|
|
10833
10833
|
m += g * i / 256 * b, F += g * s / 256 * b;
|
|
10834
|
-
const w = n.currentPoint.clone().subtract(new
|
|
10835
|
-
if (n.currentPoint = w.clone().add(new
|
|
10834
|
+
const w = n.currentPoint.clone().subtract(new re(u * Math.cos(m), u * Math.sin(m)));
|
|
10835
|
+
if (n.currentPoint = w.clone().add(new re(u * Math.cos(F), u * Math.sin(F))), n.isPenDown) {
|
|
10836
10836
|
let k = m;
|
|
10837
10837
|
const C = [];
|
|
10838
10838
|
if (C.push(
|
|
10839
|
-
w.clone().add(new
|
|
10839
|
+
w.clone().add(new re(u * Math.cos(k), u * Math.sin(k)))
|
|
10840
10840
|
), v > 0)
|
|
10841
10841
|
for (; k + v < F; )
|
|
10842
10842
|
k += v, C.push(
|
|
10843
|
-
w.clone().add(new
|
|
10843
|
+
w.clone().add(new re(u * Math.cos(k), u * Math.sin(k)))
|
|
10844
10844
|
);
|
|
10845
10845
|
else
|
|
10846
10846
|
for (; k + v > F; )
|
|
10847
10847
|
k += v, C.push(
|
|
10848
|
-
w.clone().add(new
|
|
10848
|
+
w.clone().add(new re(u * Math.cos(k), u * Math.sin(k)))
|
|
10849
10849
|
);
|
|
10850
|
-
C.push(w.clone().add(new
|
|
10850
|
+
C.push(w.clone().add(new re(u * Math.cos(F), u * Math.sin(F)))), n.currentPolyline.push(...C);
|
|
10851
10851
|
}
|
|
10852
10852
|
return a;
|
|
10853
10853
|
}
|
|
10854
10854
|
handleBulgeArc(e, r, n) {
|
|
10855
10855
|
let a = r;
|
|
10856
|
-
const i = new
|
|
10856
|
+
const i = new re();
|
|
10857
10857
|
i.x = ge.byteToSByte(e[++a]), i.y = ge.byteToSByte(e[++a]);
|
|
10858
10858
|
const s = ge.byteToSByte(e[++a]);
|
|
10859
10859
|
return n.currentPoint = this.handleArcSegment(
|
|
@@ -10868,7 +10868,7 @@ class al {
|
|
|
10868
10868
|
handleMultipleBulgeArcs(e, r, n) {
|
|
10869
10869
|
let a = r;
|
|
10870
10870
|
for (; ; ) {
|
|
10871
|
-
const i = new
|
|
10871
|
+
const i = new re();
|
|
10872
10872
|
if (i.x = ge.byteToSByte(e[++a]), i.y = ge.byteToSByte(e[++a]), i.x === 0 && i.y === 0)
|
|
10873
10873
|
break;
|
|
10874
10874
|
const s = ge.byteToSByte(e[++a]);
|
|
@@ -11434,9 +11434,9 @@ yn.write = function(t, e, r, n, a, i) {
|
|
|
11434
11434
|
if (d >= S)
|
|
11435
11435
|
return 1;
|
|
11436
11436
|
if (d >>>= 0, S >>>= 0, T >>>= 0, L >>>= 0, this === f) return 0;
|
|
11437
|
-
for (var A = L - T, V = S - d, Y = Math.min(A, V), J = this.slice(T, L), de = f.slice(d, S),
|
|
11438
|
-
if (J[
|
|
11439
|
-
A = J[
|
|
11437
|
+
for (var A = L - T, V = S - d, Y = Math.min(A, V), J = this.slice(T, L), de = f.slice(d, S), te = 0; te < Y; ++te)
|
|
11438
|
+
if (J[te] !== de[te]) {
|
|
11439
|
+
A = J[te], V = de[te];
|
|
11440
11440
|
break;
|
|
11441
11441
|
}
|
|
11442
11442
|
return A < V ? -1 : V < A ? 1 : 0;
|
|
@@ -11475,12 +11475,12 @@ yn.write = function(t, e, r, n, a, i) {
|
|
|
11475
11475
|
de !== -1 && (J -= J - de), de = -1;
|
|
11476
11476
|
} else
|
|
11477
11477
|
for (d + V > A && (d = A - V), J = d; J >= 0; J--) {
|
|
11478
|
-
for (var
|
|
11478
|
+
for (var te = !0, Ht = 0; Ht < V; Ht++)
|
|
11479
11479
|
if (Y(y, J + Ht) !== Y(f, Ht)) {
|
|
11480
|
-
|
|
11480
|
+
te = !1;
|
|
11481
11481
|
break;
|
|
11482
11482
|
}
|
|
11483
|
-
if (
|
|
11483
|
+
if (te) return J;
|
|
11484
11484
|
}
|
|
11485
11485
|
return -1;
|
|
11486
11486
|
}
|
|
@@ -11567,19 +11567,19 @@ yn.write = function(t, e, r, n, a, i) {
|
|
|
11567
11567
|
for (var S = [], T = f; T < d; ) {
|
|
11568
11568
|
var L = y[T], A = null, V = L > 239 ? 4 : L > 223 ? 3 : L > 191 ? 2 : 1;
|
|
11569
11569
|
if (T + V <= d) {
|
|
11570
|
-
var Y, J, de,
|
|
11570
|
+
var Y, J, de, te;
|
|
11571
11571
|
switch (V) {
|
|
11572
11572
|
case 1:
|
|
11573
11573
|
L < 128 && (A = L);
|
|
11574
11574
|
break;
|
|
11575
11575
|
case 2:
|
|
11576
|
-
Y = y[T + 1], (Y & 192) === 128 && (
|
|
11576
|
+
Y = y[T + 1], (Y & 192) === 128 && (te = (L & 31) << 6 | Y & 63, te > 127 && (A = te));
|
|
11577
11577
|
break;
|
|
11578
11578
|
case 3:
|
|
11579
|
-
Y = y[T + 1], J = y[T + 2], (Y & 192) === 128 && (J & 192) === 128 && (
|
|
11579
|
+
Y = y[T + 1], J = y[T + 2], (Y & 192) === 128 && (J & 192) === 128 && (te = (L & 15) << 12 | (Y & 63) << 6 | J & 63, te > 2047 && (te < 55296 || te > 57343) && (A = te));
|
|
11580
11580
|
break;
|
|
11581
11581
|
case 4:
|
|
11582
|
-
Y = y[T + 1], J = y[T + 2], de = y[T + 3], (Y & 192) === 128 && (J & 192) === 128 && (de & 192) === 128 && (
|
|
11582
|
+
Y = y[T + 1], J = y[T + 2], de = y[T + 3], (Y & 192) === 128 && (J & 192) === 128 && (de & 192) === 128 && (te = (L & 15) << 18 | (Y & 63) << 12 | (J & 63) << 6 | de & 63, te > 65535 && te < 1114112 && (A = te));
|
|
11583
11583
|
}
|
|
11584
11584
|
}
|
|
11585
11585
|
A === null ? (A = 65533, V = 1) : A > 65535 && (A -= 65536, S.push(A >>> 10 & 1023 | 55296), A = 56320 | A & 1023), S.push(A), T += V;
|
|
@@ -22180,7 +22180,7 @@ class Wl extends Ka {
|
|
|
22180
22180
|
a += r, this.addUnsupportedChar(s);
|
|
22181
22181
|
continue;
|
|
22182
22182
|
}
|
|
22183
|
-
n.push(o.offset(new
|
|
22183
|
+
n.push(o.offset(new re(a, 0))), a += o.width;
|
|
22184
22184
|
}
|
|
22185
22185
|
return n;
|
|
22186
22186
|
}
|
|
@@ -22639,10 +22639,10 @@ var Ze;
|
|
|
22639
22639
|
(function(t) {
|
|
22640
22640
|
t[t.BOTTOM = 0] = "BOTTOM", t[t.MIDDLE = 1] = "MIDDLE", t[t.TOP = 2] = "TOP";
|
|
22641
22641
|
})(Ze || (Ze = {}));
|
|
22642
|
-
var
|
|
22642
|
+
var ee;
|
|
22643
22643
|
(function(t) {
|
|
22644
22644
|
t[t.DEFAULT = 0] = "DEFAULT", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.CENTER = 3] = "CENTER", t[t.JUSTIFIED = 4] = "JUSTIFIED", t[t.DISTRIBUTED = 5] = "DISTRIBUTED";
|
|
22645
|
-
})(
|
|
22645
|
+
})(ee || (ee = {}));
|
|
22646
22646
|
var Xe;
|
|
22647
22647
|
(function(t) {
|
|
22648
22648
|
t[t.NONE = 0] = "NONE", t[t.UNDERLINE = 1] = "UNDERLINE", t[t.OVERLINE = 2] = "OVERLINE", t[t.STRIKE_THROUGH = 4] = "STRIKE_THROUGH";
|
|
@@ -22653,11 +22653,11 @@ const ql = {
|
|
|
22653
22653
|
p: "±",
|
|
22654
22654
|
"%": "%"
|
|
22655
22655
|
}, Xl = {
|
|
22656
|
-
l:
|
|
22657
|
-
r:
|
|
22658
|
-
c:
|
|
22659
|
-
j:
|
|
22660
|
-
d:
|
|
22656
|
+
l: ee.LEFT,
|
|
22657
|
+
r: ee.RIGHT,
|
|
22658
|
+
c: ee.CENTER,
|
|
22659
|
+
j: ee.JUSTIFIED,
|
|
22660
|
+
d: ee.DISTRIBUTED
|
|
22661
22661
|
};
|
|
22662
22662
|
function Yl(t) {
|
|
22663
22663
|
const [e, r, n] = t;
|
|
@@ -23179,7 +23179,7 @@ class Jl {
|
|
|
23179
23179
|
break;
|
|
23180
23180
|
case "q": {
|
|
23181
23181
|
const h = r.get();
|
|
23182
|
-
for (s = Xl[h] ||
|
|
23182
|
+
for (s = Xl[h] || ee.DEFAULT; r.peek() === ","; )
|
|
23183
23183
|
r.consume(1);
|
|
23184
23184
|
break;
|
|
23185
23185
|
}
|
|
@@ -23224,11 +23224,11 @@ class Jl {
|
|
|
23224
23224
|
indent: 0,
|
|
23225
23225
|
left: 0,
|
|
23226
23226
|
right: 0,
|
|
23227
|
-
align:
|
|
23227
|
+
align: ee.DEFAULT,
|
|
23228
23228
|
tabs: []
|
|
23229
23229
|
};
|
|
23230
23230
|
const c = {};
|
|
23231
|
-
return o.indent !== 0 && (c.indent = 0), o.left !== 0 && (c.left = 0), o.right !== 0 && (c.right = 0), o.align !==
|
|
23231
|
+
return o.indent !== 0 && (c.indent = 0), o.left !== 0 && (c.left = 0), o.right !== 0 && (c.right = 0), o.align !== ee.DEFAULT && (c.align = ee.DEFAULT), JSON.stringify(o.tabs) !== JSON.stringify([]) && (c.tabs = []), c;
|
|
23232
23232
|
}
|
|
23233
23233
|
const i = () => {
|
|
23234
23234
|
let s = "";
|
|
@@ -23611,7 +23611,7 @@ class Dt {
|
|
|
23611
23611
|
indent: 0,
|
|
23612
23612
|
left: 0,
|
|
23613
23613
|
right: 0,
|
|
23614
|
-
align:
|
|
23614
|
+
align: ee.DEFAULT,
|
|
23615
23615
|
tabs: []
|
|
23616
23616
|
};
|
|
23617
23617
|
}
|
|
@@ -24126,7 +24126,7 @@ class nf {
|
|
|
24126
24126
|
* - underline/overline/strike-through flags
|
|
24127
24127
|
*/
|
|
24128
24128
|
applyPropertyChanges(e) {
|
|
24129
|
-
this.applyFontFaceChange(e.fontFace), this.applyColorCommandChanges(e), this.applyWidthFactorChange(e.widthFactor), this.applyCapHeightChange(e.capHeight), this.applyCharTrackingChange(e.charTrackingFactor), this.
|
|
24129
|
+
this.applyFontFaceChange(e.fontFace), this.applyColorCommandChanges(e), this.applyWidthFactorChange(e.widthFactor), this.applyCapHeightChange(e.capHeight), this.applyCharTrackingChange(e.charTrackingFactor), this.applyParagraphMarginsOnly(e.paragraph), typeof e.underline == "boolean" && (this._currentContext.underline = e.underline), typeof e.overline == "boolean" && (this._currentContext.overline = e.overline), typeof e.strikeThrough == "boolean" && (this._currentContext.strikeThrough = e.strikeThrough), e.oblique !== void 0 && (this._currentContext.oblique = e.oblique);
|
|
24130
24130
|
}
|
|
24131
24131
|
/**
|
|
24132
24132
|
* Apply a font face change to the current render context, including
|
|
@@ -24188,12 +24188,23 @@ class nf {
|
|
|
24188
24188
|
isRelative: !1
|
|
24189
24189
|
});
|
|
24190
24190
|
}
|
|
24191
|
+
/**
|
|
24192
|
+
* Applies indent and margins from a paragraph snapshot only.
|
|
24193
|
+
*
|
|
24194
|
+
* Used when exiting `{}` formatting groups: the parser restores full context
|
|
24195
|
+
* including `paragraph.align`, but paragraph alignment is not scoped to `{}`
|
|
24196
|
+
* (see class comment on `_currentHorizontalAlignment`). Restoring align here
|
|
24197
|
+
* would undo an active `\\p...` alignment before the line is finalized.
|
|
24198
|
+
*/
|
|
24199
|
+
applyParagraphMarginsOnly(e) {
|
|
24200
|
+
e && (typeof e.indent == "number" && (this._currentIndent = e.indent * this.defaultFontSize, this._hOffset += this._currentIndent), typeof e.left == "number" && (this._currentLeftMargin = e.left * this.defaultFontSize), typeof e.right == "number" && (this._currentRightMargin = e.right * this.defaultFontSize));
|
|
24201
|
+
}
|
|
24191
24202
|
/**
|
|
24192
24203
|
* Apply paragraph-level changes such as alignment and margins.
|
|
24193
24204
|
* @param paragraph Paragraph change data.
|
|
24194
24205
|
*/
|
|
24195
24206
|
applyParagraphChange(e) {
|
|
24196
|
-
e && (
|
|
24207
|
+
e && ("align" in e && (this._currentHorizontalAlignment = e.align), typeof e.indent == "number" && (this._currentIndent = e.indent * this.defaultFontSize, this._hOffset += this._currentIndent), typeof e.left == "number" && (this._currentLeftMargin = e.left * this.defaultFontSize), typeof e.right == "number" && (this._currentRightMargin = e.right * this.defaultFontSize));
|
|
24197
24208
|
}
|
|
24198
24209
|
/**
|
|
24199
24210
|
* Reset paragraph properties to their default values from options.
|
|
@@ -24339,7 +24350,7 @@ class nf {
|
|
|
24339
24350
|
let s = 0;
|
|
24340
24351
|
for (let o = 0; o < e.length; o++) {
|
|
24341
24352
|
const c = this.getCharShape(e[o]);
|
|
24342
|
-
c ? this.currentHorizontalAlignment ==
|
|
24353
|
+
c ? this.currentHorizontalAlignment == ee.DISTRIBUTED ? s += c.width * this.currentWidthFactor : s += c.width * this.currentWordSpace * this.currentWidthFactor : s += this._currentContext.blankWidth;
|
|
24343
24354
|
}
|
|
24344
24355
|
this.hOffset + s > (this.maxLineWidth || 1 / 0) && (this._vOffset <= 0 && this._currentLineObjects.length <= 0 || (this.recordVisualLineBreak(a, i), this.advanceToNextLine(!1)));
|
|
24345
24356
|
for (let o = 0; o < e.length; o++)
|
|
@@ -24552,7 +24563,7 @@ class nf {
|
|
|
24552
24563
|
const u = this.fontManager.getFontType(this.currentFont);
|
|
24553
24564
|
this._currentContext.bold && u === "mesh" && o.scale(1.06, 1.06, 1), this.hOffset > (this.maxLineWidth || 1 / 0) && (this.recordVisualLineBreak(a, i), this.advanceToNextLine(!1));
|
|
24554
24565
|
const h = this.hOffset, p = this.flowDirection == Ye.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentLayoutFontSize, l = s.width * this.currentWidthFactor, g = this.currentLayoutFontSize;
|
|
24555
|
-
if (o.translate(h, p, 0), this.currentHorizontalAlignment ==
|
|
24566
|
+
if (o.translate(h, p, 0), this.currentHorizontalAlignment == ee.DISTRIBUTED ? this._hOffset += s.width * this.currentWidthFactor : this._hOffset += s.width * this.currentWordSpace * this.currentWidthFactor, r.push(o), this._lineHasRenderableChar = !0, this._options.collectCharBoxes !== !1) {
|
|
24556
24567
|
o.userData.char = e, o.boundingBox || o.computeBoundingBox();
|
|
24557
24568
|
const b = new M.Box3().copy(o.boundingBox);
|
|
24558
24569
|
o instanceof M.ShapeGeometry ? (this._lastCharBoxTarget = "mesh", a.push({
|
|
@@ -24717,28 +24728,29 @@ class nf {
|
|
|
24717
24728
|
}
|
|
24718
24729
|
};
|
|
24719
24730
|
switch (this.currentHorizontalAlignment) {
|
|
24720
|
-
case
|
|
24731
|
+
case ee.LEFT:
|
|
24732
|
+
case ee.JUSTIFIED: {
|
|
24721
24733
|
const s = this._currentLeftMargin - n.min.x, o = /* @__PURE__ */ new Set();
|
|
24722
24734
|
e.forEach((c) => {
|
|
24723
24735
|
c.geometry.translate(s, 0, 0), o.has(c.owner) || (i(c.owner, s), o.add(c.owner));
|
|
24724
24736
|
});
|
|
24725
24737
|
break;
|
|
24726
24738
|
}
|
|
24727
|
-
case
|
|
24739
|
+
case ee.CENTER: {
|
|
24728
24740
|
const s = this._currentLeftMargin + (this.maxLineWidth - a.x) / 2 - n.min.x, o = /* @__PURE__ */ new Set();
|
|
24729
24741
|
e.forEach((c) => {
|
|
24730
24742
|
c.geometry.translate(s, 0, 0), o.has(c.owner) || (i(c.owner, s), o.add(c.owner));
|
|
24731
24743
|
});
|
|
24732
24744
|
break;
|
|
24733
24745
|
}
|
|
24734
|
-
case
|
|
24746
|
+
case ee.RIGHT: {
|
|
24735
24747
|
const s = this._currentLeftMargin + this.maxLineWidth - a.x - n.min.x, o = /* @__PURE__ */ new Set();
|
|
24736
24748
|
e.forEach((c) => {
|
|
24737
24749
|
c.geometry.translate(s, 0, 0), o.has(c.owner) || (i(c.owner, s), o.add(c.owner));
|
|
24738
24750
|
});
|
|
24739
24751
|
break;
|
|
24740
24752
|
}
|
|
24741
|
-
case
|
|
24753
|
+
case ee.DISTRIBUTED: {
|
|
24742
24754
|
const s = e.length > 1 ? (this.maxLineWidth - a.x) / (e.length - 1) : 0, o = /* @__PURE__ */ new Set();
|
|
24743
24755
|
e.forEach((c, u) => {
|
|
24744
24756
|
const h = s * u + (this._currentLeftMargin - n.min.x);
|
|
@@ -25019,23 +25031,23 @@ class cr extends M.Object3D {
|
|
|
25019
25031
|
this.styleManager.unsupportedTextStyles[m] || (this.styleManager.unsupportedTextStyles[m] = 0), this.styleManager.unsupportedTextStyles[m]++;
|
|
25020
25032
|
}
|
|
25021
25033
|
const n = e.width || 0, a = Number.isFinite(n) && n > 0;
|
|
25022
|
-
let i =
|
|
25034
|
+
let i = ee.LEFT;
|
|
25023
25035
|
a && e.attachmentPoint && ([
|
|
25024
25036
|
X.TopLeft,
|
|
25025
25037
|
X.MiddleLeft,
|
|
25026
25038
|
X.BottomLeft,
|
|
25027
25039
|
X.BaselineLeft
|
|
25028
|
-
].includes(e.attachmentPoint) ? i =
|
|
25040
|
+
].includes(e.attachmentPoint) ? i = ee.LEFT : [
|
|
25029
25041
|
X.TopCenter,
|
|
25030
25042
|
X.MiddleCenter,
|
|
25031
25043
|
X.BottomCenter,
|
|
25032
25044
|
X.BaselineCenter
|
|
25033
|
-
].includes(e.attachmentPoint) ? i =
|
|
25045
|
+
].includes(e.attachmentPoint) ? i = ee.CENTER : [
|
|
25034
25046
|
X.TopRight,
|
|
25035
25047
|
X.MiddleRight,
|
|
25036
25048
|
X.BottomRight,
|
|
25037
25049
|
X.BaselineRight
|
|
25038
|
-
].includes(e.attachmentPoint) && (i =
|
|
25050
|
+
].includes(e.attachmentPoint) && (i = ee.RIGHT));
|
|
25039
25051
|
let s = Ze.BOTTOM;
|
|
25040
25052
|
e.attachmentPoint && ([
|
|
25041
25053
|
X.TopLeft,
|
|
@@ -25746,12 +25758,13 @@ export {
|
|
|
25746
25758
|
Dt as MTextContext,
|
|
25747
25759
|
Ye as MTextFlowDirection,
|
|
25748
25760
|
Ze as MTextLineAlignment,
|
|
25749
|
-
|
|
25761
|
+
ee as MTextParagraphAlignment,
|
|
25750
25762
|
Jl as MTextParser,
|
|
25751
25763
|
Xe as MTextStroke,
|
|
25752
25764
|
Nr as MTextToken,
|
|
25753
25765
|
sf as MainThreadRenderer,
|
|
25754
25766
|
tr as STACK_DIVIDER_CHAR,
|
|
25767
|
+
il as ShxParserFont,
|
|
25755
25768
|
Pr as TextScanner,
|
|
25756
25769
|
Z as TokenType,
|
|
25757
25770
|
lf as UnifiedRenderer,
|