@objectifthunes/three-book 0.5.6 → 0.5.8
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/demo-kit/dist/index.d.ts +1159 -0
- package/demo-kit/dist/index.js +336 -0
- package/dist/TextBlock.d.ts +35 -1
- package/dist/TextBlock.d.ts.map +1 -1
- package/dist/index.js +185 -141
- package/dist/textContentUtils.d.ts.map +1 -1
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as c from "three";
|
|
2
|
-
class
|
|
2
|
+
class Ct {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.m_PositionX = 0, this.m_PositionZ = 0, this.m_DirectionX = 0, this.m_DirectionZ = 0, this.m_EulerY = 0, this.m_Radius = 0, this._positionOut = new c.Vector3(), this._scratchRP1 = new c.Vector3(), this._scratchRP2 = new c.Vector3(), this._scratchRollClosest = new c.Vector3(), this._scratchRollEuler = new c.Vector3(), this._scratchOffsetRoll = new c.Vector3();
|
|
5
5
|
}
|
|
@@ -78,7 +78,7 @@ class wt {
|
|
|
78
78
|
}
|
|
79
79
|
// ── Value-type clone ──────────────────────────────────────────────────
|
|
80
80
|
clone() {
|
|
81
|
-
const t = new
|
|
81
|
+
const t = new Ct();
|
|
82
82
|
return t.m_PositionX = this.m_PositionX, t.m_PositionZ = this.m_PositionZ, t.m_DirectionX = this.m_DirectionX, t.m_DirectionZ = this.m_DirectionZ, t.m_EulerY = this.m_EulerY, t.m_Radius = this.m_Radius, t;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -173,15 +173,15 @@ function ne(r, t, e, s, i) {
|
|
|
173
173
|
if (T.rootCount === 1)
|
|
174
174
|
return i.set(T.root0, g * T.root0 + p);
|
|
175
175
|
if (T.rootCount === 2) {
|
|
176
|
-
let P = T.root0,
|
|
177
|
-
return a < u && ([P,
|
|
176
|
+
let P = T.root0, w = T.root1;
|
|
177
|
+
return a < u && ([P, w] = [w, P]), i.set(w, g * w + p);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
return i.copy(r);
|
|
181
181
|
}
|
|
182
|
-
const ft = new c.Vector3(),
|
|
182
|
+
const ft = new c.Vector3(), bt = new c.Vector3(), Rt = new c.Ray();
|
|
183
183
|
function Dt(r, t) {
|
|
184
|
-
return ft.copy(r.origin).applyMatrix4(t),
|
|
184
|
+
return ft.copy(r.origin).applyMatrix4(t), bt.copy(r.origin).add(r.direction).applyMatrix4(t), Rt.set(ft, bt.sub(ft).normalize()), Rt;
|
|
185
185
|
}
|
|
186
186
|
function re(r) {
|
|
187
187
|
const t = r.x;
|
|
@@ -216,7 +216,7 @@ function Vt(r, t, e) {
|
|
|
216
216
|
class oe {
|
|
217
217
|
// ---- Constructor ----
|
|
218
218
|
constructor(t, e, s, i) {
|
|
219
|
-
this.m_UseBackContentForSides = !1, this.m_Prev = null, this.m_Next = null, this.m_NoHole = !1, this.m_Size = new c.Vector2(), this.m_Thickness = 0, this.m_Stiffness = 0, this.m_Margin = 0, this.m_MeshDataType = 1, this.m_Cylinder = new
|
|
219
|
+
this.m_UseBackContentForSides = !1, this.m_Prev = null, this.m_Next = null, this.m_NoHole = !1, this.m_Size = new c.Vector2(), this.m_Thickness = 0, this.m_Stiffness = 0, this.m_Margin = 0, this.m_MeshDataType = 1, this.m_Cylinder = new Ct(), this.m_IsRolling = !1, this.m_IsAutoTurning = !1, this.m_WorldPlane = new c.Plane(), this.m_StartHandle = new c.Vector3(), this.m_CurrentHandle = new c.Vector3(), this.m_EndHandle = new c.Vector3(), this.m_PrevHandle = new c.Vector3(), this.m_HandleOffset = new c.Vector3(), this.m_HandleVelocity = new c.Vector3(), this.m_HandleVelocities = [], this.m_SubMeshCount = -1, this.m_MinTurningRadius = 0, this.m_TurningRadius = 0, this.m_FallDuration = 0, this.m_FallTime = 0.2, this.m_XTime = 0, this.m_ZTime = 0, this.m_IsTurning = !1, this.m_IsFalling = !1, this.m_IsFallingLeft = !1, this.m_isMeshChanged = !1, this.sizeXOffset = 0, this._ucStartHandle = new c.Vector3(), this._ucCurrentHandle = new c.Vector3(), this._ucHandleDir = new c.Vector3(), this._ucA = new c.Vector3(), this._ucB = new c.Vector3(), this._ucMid = new c.Vector3(), this._ucRollResult = new c.Vector3(), this._ucCylDir = new c.Vector3(), this._utV1 = new c.Vector3(), this._utV2 = new c.Vector3(), this._utV3 = new c.Vector3(), this._utV4 = new c.Vector3(), this._chP = new c.Vector3(), this._chA = new c.Vector3(), this._chC = new c.Vector3(), this._chEllipseCenter1 = new c.Vector2(), this._chEllipseCenter2 = new c.Vector2(), this._chEllipseSize1 = new c.Vector2(), this._chEllipseSize2 = new c.Vector2(), this._chP2 = new c.Vector2(), this._dirResult = new c.Vector3(), this._gdA = new c.Vector3(), this._gdB = new c.Vector3(), this._rlMatrix = new c.Matrix4(), this._rlPlane = new c.Plane(new c.Vector3(0, 1, 0), 0), this._rlTarget = new c.Vector3(), this._rlNormal = new c.Vector3(), this._utTarget = new c.Vector3(), this._ufSmoothTime = new c.Vector3(), this._umFrontST = new c.Vector4(), this._umBackST = new c.Vector4(), this._h2uResult = new c.Vector2(), this.m_IsCover = t, this.m_Book = s, this.m_Index = e, this.m_Renderer = i, this.m_Transform = i.transform;
|
|
220
220
|
}
|
|
221
221
|
// ---- Properties (mirrors C#) ----
|
|
222
222
|
get isMeshChanged() {
|
|
@@ -1103,8 +1103,8 @@ class Ot {
|
|
|
1103
1103
|
for (let _ = 0; _ < h - 1; _++) {
|
|
1104
1104
|
const g = _ + 1;
|
|
1105
1105
|
for (let p = 0; p < n - 1; p++) {
|
|
1106
|
-
const M = p + 1, T = _ * n + p, P = _ * n + M,
|
|
1107
|
-
At(I,
|
|
1106
|
+
const M = p + 1, T = _ * n + p, P = _ * n + M, w = g * n + p, k = g * n + M, I = t[T], Z = t[P], U = t[w], z = t[k];
|
|
1107
|
+
At(I, U, Z, o), At(z, Z, U, u), l.addVectors(o, u), s[T].add(l), s[P].add(l), s[w].add(l), s[k].add(l);
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
for (let _ = 0; _ < a; _++)
|
|
@@ -1320,7 +1320,7 @@ class pe {
|
|
|
1320
1320
|
return e[s - 1].value;
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
|
-
function
|
|
1323
|
+
function Lt(r, t) {
|
|
1324
1324
|
return r + Math.random() * (t - r);
|
|
1325
1325
|
}
|
|
1326
1326
|
class at {
|
|
@@ -1391,12 +1391,12 @@ class at {
|
|
|
1391
1391
|
getValue(t, e) {
|
|
1392
1392
|
if (this.m_Mode === 0) return this.m_Constant;
|
|
1393
1393
|
if (this.m_Mode === 1)
|
|
1394
|
-
return
|
|
1394
|
+
return Lt(this.m_ConstantMin, this.m_ConstantMax);
|
|
1395
1395
|
const s = this.m_CurveTimeMode === 0 ? t : e;
|
|
1396
1396
|
if (this.m_Mode === 2)
|
|
1397
1397
|
return this.m_Curve.evaluate(s);
|
|
1398
1398
|
if (this.m_Mode === 3)
|
|
1399
|
-
return
|
|
1399
|
+
return Lt(
|
|
1400
1400
|
this.m_CurveMin.evaluate(s),
|
|
1401
1401
|
this.m_CurveMax.evaluate(s)
|
|
1402
1402
|
);
|
|
@@ -1495,7 +1495,7 @@ const D = class D {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
};
|
|
1497
1497
|
D.kMinTwist = -1, D.kMaxTwist = 1, D.kMinBend = 0, D.kMaxBend = 1, D.kMinDuration = 0, D.kMaxDuration = 5;
|
|
1498
|
-
let
|
|
1498
|
+
let Zt = D;
|
|
1499
1499
|
class xe extends Error {
|
|
1500
1500
|
constructor() {
|
|
1501
1501
|
super(
|
|
@@ -1862,8 +1862,8 @@ const W = class W extends c.Group {
|
|
|
1862
1862
|
var B;
|
|
1863
1863
|
if (this.clear(), this.m_Content === null || this.m_Content.isEmpty || this.m_Binding === null) return;
|
|
1864
1864
|
if (this.m_MeshFactory === null && (this.m_MeshFactory = new ce()), this.m_RendererFactory === null) {
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1865
|
+
const C = new c.Object3D();
|
|
1866
|
+
C.name = "Root", this.add(C), this.m_Root = C, this.m_RendererFactory = new ue(this.m_Root);
|
|
1867
1867
|
}
|
|
1868
1868
|
this.m_Direction = this.m_Content.direction;
|
|
1869
1869
|
const t = this.m_Direction > 1 ? Math.PI / 2 : 0;
|
|
@@ -1875,9 +1875,9 @@ const W = class W extends c.Group {
|
|
|
1875
1875
|
const a = this.m_CoverPaperCount + this.m_PagePaperCount, o = Math.floor(i.length / 4);
|
|
1876
1876
|
let u = 0, l = 0, m = 0;
|
|
1877
1877
|
this.m_Papers = new Array(a);
|
|
1878
|
-
for (let
|
|
1879
|
-
const v = this.m_HasCover && (
|
|
1880
|
-
|
|
1878
|
+
for (let C = 0; C < a; C++) {
|
|
1879
|
+
const v = this.m_HasCover && (C < o || C >= a - o), N = this.m_RendererFactory.get("Paper"), b = this.m_Papers[C] = new oe(v, C, this, N);
|
|
1880
|
+
b.renderer.castShadows = this.m_CastShadows, C < Math.round(c.MathUtils.lerp(0, a, h)) && (b.transform.scale.set(-1, 1, 1), b.setTime(1)), v ? (b.setContentData(i[l++], i[l++], C > o), b.setMaterialData(e), b.setPaperSetup(this.m_CoverPaperSetup)) : (b.setContentData(n[u++], n[u++]), b.setMaterialData(s), b.setPaperSetup(this.m_PagePaperSetup)), m += b.thickness;
|
|
1881
1881
|
}
|
|
1882
1882
|
this.m_TotalThickness = m;
|
|
1883
1883
|
const f = this.m_Papers[0].thickness, d = this.m_Papers[Math.floor(a / 2)].thickness;
|
|
@@ -1891,11 +1891,11 @@ const W = class W extends c.Group {
|
|
|
1891
1891
|
this.m_RendererFactory,
|
|
1892
1892
|
this.m_MeshFactory
|
|
1893
1893
|
), this.m_Bound.binderRenderer.setVisibility(!this.m_HideBinder);
|
|
1894
|
-
const T = this.m_ReduceOverdraw && n.length > 0, P = this.m_ReduceSubMeshes,
|
|
1895
|
-
for (let
|
|
1896
|
-
const v = this.m_Papers[
|
|
1897
|
-
|
|
1898
|
-
|
|
1894
|
+
const T = this.m_ReduceOverdraw && n.length > 0, P = this.m_ReduceSubMeshes, w = this.createPaperMeshDataPool(this.m_PagePaperSetup, !0, P), k = T ? this.createPaperMeshDataPool(this.m_PagePaperSetup, !0, P, !0) : null, I = this.createPaperMeshDataPool(this.m_PagePaperSetup, !1), Z = this.createPaperMeshDataPool(this.m_CoverPaperSetup, !0), U = this.createPaperMeshDataPool(this.m_CoverPaperSetup, !1), z = Math.floor(a / 2) - 1, E = z + 1, A = ((B = this.m_Bound) == null ? void 0 : B.bindingType) === "staple";
|
|
1895
|
+
for (let C = 0; C < a; C++) {
|
|
1896
|
+
const v = this.m_Papers[C];
|
|
1897
|
+
C !== 0 && (v.prev = this.m_Papers[C - 1]), C !== a - 1 && (v.next = this.m_Papers[C + 1]), v.noHole = A && (C === z || C === E), v.isCover ? v.setMeshData(Z.get(), null, U) : v.setMeshData(
|
|
1898
|
+
w.get(),
|
|
1899
1899
|
(k == null ? void 0 : k.get()) ?? null,
|
|
1900
1900
|
I
|
|
1901
1901
|
);
|
|
@@ -2015,14 +2015,14 @@ const W = class W extends c.Group {
|
|
|
2015
2015
|
}
|
|
2016
2016
|
};
|
|
2017
2017
|
W.s_Instances = /* @__PURE__ */ new Set(), W.s_InstancesArray = null;
|
|
2018
|
-
let
|
|
2018
|
+
let wt = W;
|
|
2019
2019
|
class Me {
|
|
2020
2020
|
constructor() {
|
|
2021
2021
|
this.baseXArray = [], this.baseZArray = [], this.baseXOffset = 0, this.baseVertexCount = 0, this.xSeams = [], this.zSeams = [], this.xNoneSeamIndexes = [], this.borders = [], this.texcoords = [], this.weights = [], this.triangles = [], this.frontTriangles = [], this.backTriangles = [], this.borderTriangles = [], this.vertexCount = 0, this.subMeshCount = 0, this.size = new c.Vector2(), this.thickness = 0;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
const $t = Object.freeze(new c.Vector4(1, 1, 0, 0));
|
|
2025
|
-
class
|
|
2025
|
+
class Le {
|
|
2026
2026
|
constructor() {
|
|
2027
2027
|
this.m_BookContent = null, this.m_IsActive = !1, this.onActiveChangedCallback = null;
|
|
2028
2028
|
}
|
|
@@ -2057,7 +2057,7 @@ class Ze {
|
|
|
2057
2057
|
this.m_IsActive !== t && (this.m_IsActive = t, this.onActiveChanged(), (e = this.onActiveChangedCallback) == null || e.call(this));
|
|
2058
2058
|
}
|
|
2059
2059
|
}
|
|
2060
|
-
class
|
|
2060
|
+
class Ut {
|
|
2061
2061
|
constructor(t, e) {
|
|
2062
2062
|
this.m_Texture = t, this.m_TextureST = e ?? new c.Vector4(1, 1, 0, 0);
|
|
2063
2063
|
}
|
|
@@ -2075,7 +2075,7 @@ class Et {
|
|
|
2075
2075
|
setActive(t) {
|
|
2076
2076
|
}
|
|
2077
2077
|
}
|
|
2078
|
-
class
|
|
2078
|
+
class Ze {
|
|
2079
2079
|
constructor() {
|
|
2080
2080
|
this.m_Direction = j.LeftToRight, this.m_Covers = [null, null, null, null], this.m_Pages = [null, null, null, null, null, null, null, null], this.m_Book = null, this._cachedCovers = null, this._cachedPages = null;
|
|
2081
2081
|
}
|
|
@@ -2130,11 +2130,11 @@ class Ue {
|
|
|
2130
2130
|
getContent(t) {
|
|
2131
2131
|
if (t !== null) {
|
|
2132
2132
|
if (t instanceof c.Texture)
|
|
2133
|
-
return new
|
|
2133
|
+
return new Ut(t);
|
|
2134
2134
|
if (typeof t.init == "function")
|
|
2135
2135
|
return t;
|
|
2136
2136
|
}
|
|
2137
|
-
return new
|
|
2137
|
+
return new Ut(null);
|
|
2138
2138
|
}
|
|
2139
2139
|
init(t) {
|
|
2140
2140
|
this.m_Book = t, this._cachedCovers = null, this._cachedPages = null;
|
|
@@ -2182,14 +2182,14 @@ class Ue {
|
|
|
2182
2182
|
return !this.isCoverPaperSideIndex(t);
|
|
2183
2183
|
}
|
|
2184
2184
|
}
|
|
2185
|
-
class
|
|
2185
|
+
class Ue {
|
|
2186
2186
|
constructor(t, e) {
|
|
2187
2187
|
this.enabled = !0, this.m_Raycaster = new c.Raycaster(), this.m_Mouse = new c.Vector2(), this.m_SelectedBook = null, this.m_IsPointerDown = !1, this.m_OnPointerDown = (s) => {
|
|
2188
2188
|
var n;
|
|
2189
2189
|
if (!this.enabled || s.button !== 0) return;
|
|
2190
2190
|
this.m_IsPointerDown = !0;
|
|
2191
2191
|
const i = this.m_GetRay(s);
|
|
2192
|
-
for (const h of
|
|
2192
|
+
for (const h of wt.instances)
|
|
2193
2193
|
if (h.startTurning(i)) {
|
|
2194
2194
|
this.m_SelectedBook = h, (n = this.onTurnStart) == null || n.call(this, h);
|
|
2195
2195
|
break;
|
|
@@ -2211,7 +2211,7 @@ class Ee {
|
|
|
2211
2211
|
}
|
|
2212
2212
|
class ye {
|
|
2213
2213
|
}
|
|
2214
|
-
class
|
|
2214
|
+
class we {
|
|
2215
2215
|
constructor(t, e) {
|
|
2216
2216
|
this.bindingType = "", this.m_Book = t, this.m_Root = e;
|
|
2217
2217
|
}
|
|
@@ -2219,7 +2219,7 @@ class Ce {
|
|
|
2219
2219
|
dispose() {
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
function
|
|
2222
|
+
function Et(r, t, e, s) {
|
|
2223
2223
|
const i = 1 - s;
|
|
2224
2224
|
return new c.Vector3(
|
|
2225
2225
|
i * i * r.x + 2 * i * s * t.x + s * s * e.x,
|
|
@@ -2230,10 +2230,10 @@ function Lt(r, t, e, s) {
|
|
|
2230
2230
|
function Nt(r, t) {
|
|
2231
2231
|
return r++, r === t ? 0 : r;
|
|
2232
2232
|
}
|
|
2233
|
-
function
|
|
2233
|
+
function Ce(r, t) {
|
|
2234
2234
|
return r === 0 ? t - 1 : r - 1;
|
|
2235
2235
|
}
|
|
2236
|
-
const Pe = 0.01, Te = 0.1, Se = 0.04, ve = 0.4, ke = 2, Be = 10,
|
|
2236
|
+
const Pe = 0.01, Te = 0.1, Se = 0.04, ve = 0.4, ke = 2, Be = 10, be = 0, Re = 5;
|
|
2237
2237
|
function De(r, t) {
|
|
2238
2238
|
const e = r.clone().normalize();
|
|
2239
2239
|
if (e.lengthSq() === 0) return new c.Quaternion();
|
|
@@ -2290,10 +2290,10 @@ class Ie {
|
|
|
2290
2290
|
return this._quality;
|
|
2291
2291
|
}
|
|
2292
2292
|
set quality(t) {
|
|
2293
|
-
this._quality = H(t,
|
|
2293
|
+
this._quality = H(t, be, Re);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
|
-
class Ve extends
|
|
2296
|
+
class Ve extends we {
|
|
2297
2297
|
// ── Constructor ────────────────────────────────────────────────────────
|
|
2298
2298
|
constructor(t, e, s, i, n) {
|
|
2299
2299
|
if (super(s, i), this.bindingType = "staple", this.m_StapleMargin = 0, this.m_StapleThickness = 0, this.m_BindingRadius = 0, this.m_BindingMidSpace = 0, this.m_StackHeight = 0, this.m_BindingVertexCount = 0, this.useSharedMeshDataForLowpoly = !1, this._binderRendererAdapter = null, this.m_Quality = t, s.totalThickness * 1.25 > s.minPaperWidth)
|
|
@@ -2340,7 +2340,7 @@ class Ve extends Ce {
|
|
|
2340
2340
|
M = Math.max(M, p * 2);
|
|
2341
2341
|
let T = 0;
|
|
2342
2342
|
T += this.m_Book.totalThickness / 2, T += d;
|
|
2343
|
-
const P = -(this.m_Book.papers[0].thickness / 2 + d),
|
|
2343
|
+
const P = -(this.m_Book.papers[0].thickness / 2 + d), w = [];
|
|
2344
2344
|
{
|
|
2345
2345
|
for (let V = 0; V < m; V++) {
|
|
2346
2346
|
const G = V / (m - 1), K = F(-90, -180, G) * J, y = new c.Vector3(
|
|
@@ -2348,66 +2348,66 @@ class Ve extends Ce {
|
|
|
2348
2348
|
0,
|
|
2349
2349
|
p * Math.cos(K)
|
|
2350
2350
|
);
|
|
2351
|
-
y.x += p, y.z += p, y.x += P,
|
|
2351
|
+
y.x += p, y.z += p, y.x += P, w.push(y);
|
|
2352
2352
|
}
|
|
2353
|
-
const x = new c.Vector3(T, 0, 0),
|
|
2353
|
+
const x = new c.Vector3(T, 0, 0), L = new c.Vector3(T + _ * 0.75, 0, 0), S = new c.Vector3(T - d * 0.5, 0, M);
|
|
2354
2354
|
for (let V = 0; V < f; V++) {
|
|
2355
|
-
const G = V / (f - 1), $ =
|
|
2356
|
-
$.x += P,
|
|
2355
|
+
const G = V / (f - 1), $ = Et(x, L, S, G);
|
|
2356
|
+
$.x += P, w.push($);
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
w.reverse();
|
|
2359
2359
|
}
|
|
2360
2360
|
const k = new Array(l);
|
|
2361
2361
|
for (let x = 0; x < l; x++) {
|
|
2362
2362
|
const S = (90 - x * (360 / l)) * J;
|
|
2363
2363
|
k[x] = new c.Vector3(Math.cos(S), Math.sin(S), 0), k[x].x *= 0.75;
|
|
2364
2364
|
}
|
|
2365
|
-
const I =
|
|
2366
|
-
(
|
|
2365
|
+
const I = w.length, Z = I * l, U = new Array(Z * 2), z = new Array(Z * 2), E = new Array(
|
|
2366
|
+
(Z * 2 - 1) * l * 2 * 3
|
|
2367
2367
|
);
|
|
2368
|
-
for (let x = 0; x <
|
|
2369
|
-
|
|
2368
|
+
for (let x = 0; x < Z * 2; x++)
|
|
2369
|
+
U[x] = new c.Vector3(), z[x] = new c.Vector3();
|
|
2370
2370
|
let A = 0;
|
|
2371
2371
|
for (let x = 0; x < I; x++) {
|
|
2372
|
-
const
|
|
2372
|
+
const L = w[Ce(x, I)], S = w[x], V = w[Nt(x, I)];
|
|
2373
2373
|
let G;
|
|
2374
2374
|
if (x === 0)
|
|
2375
2375
|
G = new c.Vector3(1, 0, -2).normalize();
|
|
2376
2376
|
else if (x === I - 1)
|
|
2377
2377
|
G = new c.Vector3(0, 0, 1);
|
|
2378
2378
|
else {
|
|
2379
|
-
const it = S.clone().sub(
|
|
2379
|
+
const it = S.clone().sub(L).normalize(), nt = V.clone().sub(S).normalize();
|
|
2380
2380
|
G = it.add(nt).multiplyScalar(0.5);
|
|
2381
2381
|
}
|
|
2382
2382
|
const $ = new c.Vector3(0, 1, 0), K = De(G, $), y = A;
|
|
2383
|
-
let
|
|
2384
|
-
|
|
2383
|
+
let R = Q(0, f / 4, x);
|
|
2384
|
+
R = F(0.1, 1, R), R = Math.sqrt(R);
|
|
2385
2385
|
for (let it = 0; it < l; it++) {
|
|
2386
|
-
const nt = k[it].clone().applyQuaternion(K).multiplyScalar(
|
|
2387
|
-
|
|
2386
|
+
const nt = k[it].clone().applyQuaternion(K).multiplyScalar(R), ct = S.clone().add(nt.clone().multiplyScalar(d));
|
|
2387
|
+
U[A] = ct, z[A] = nt.clone();
|
|
2388
2388
|
const ot = S.clone().add(nt.clone().multiplyScalar(d));
|
|
2389
2389
|
ot.z = s - ot.z;
|
|
2390
|
-
const ee = y + l - it - 1, St =
|
|
2391
|
-
|
|
2390
|
+
const ee = y + l - it - 1, St = Z * 2 - ee - 1;
|
|
2391
|
+
U[St] = ot, z[St] = nt.clone(), A++;
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
2394
2394
|
let B = 0;
|
|
2395
|
-
const
|
|
2396
|
-
for (let x = 0; x <
|
|
2397
|
-
const
|
|
2395
|
+
const C = w.length * 2;
|
|
2396
|
+
for (let x = 0; x < C - 1; x++) {
|
|
2397
|
+
const L = x * l, S = (x + 1) * l;
|
|
2398
2398
|
for (let V = 0; V < l; V++) {
|
|
2399
|
-
const G = Nt(V, l), $ =
|
|
2400
|
-
|
|
2399
|
+
const G = Nt(V, l), $ = L + V, K = L + G, y = S + G, R = S + V;
|
|
2400
|
+
E[B++] = $, E[B++] = R, E[B++] = K, E[B++] = K, E[B++] = R, E[B++] = y;
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
const v = [...
|
|
2403
|
+
const v = [...U], N = [...z], b = [...E], Y = U.map((x) => x.clone()), tt = [...E];
|
|
2404
2404
|
for (let x = 0; x < a - 1; x++) {
|
|
2405
|
-
const
|
|
2405
|
+
const L = Y.length;
|
|
2406
2406
|
for (let S = 0; S < tt.length; S++)
|
|
2407
|
-
tt[S] +=
|
|
2407
|
+
tt[S] += L;
|
|
2408
2408
|
for (let S = 0; S < Y.length; S++)
|
|
2409
2409
|
Y[S].z += o + s;
|
|
2410
|
-
v.push(...Y.map((S) => S.clone())), N.push(...z.map((S) => S.clone())),
|
|
2410
|
+
v.push(...Y.map((S) => S.clone())), N.push(...z.map((S) => S.clone())), b.push(...tt);
|
|
2411
2411
|
}
|
|
2412
2412
|
const q = new Float32Array(v.length * 3), O = new Float32Array(N.length * 3);
|
|
2413
2413
|
for (let x = 0; x < v.length; x++)
|
|
@@ -2418,7 +2418,7 @@ class Ve extends Ce {
|
|
|
2418
2418
|
), e.setAttribute(
|
|
2419
2419
|
"normal",
|
|
2420
2420
|
new c.BufferAttribute(O, 3)
|
|
2421
|
-
), e.setIndex(
|
|
2421
|
+
), e.setIndex(b);
|
|
2422
2422
|
}
|
|
2423
2423
|
// ── createPaperPattern ────────────────────────────────────────────────
|
|
2424
2424
|
createPaperPattern(t, e, s, i, n, h) {
|
|
@@ -2438,39 +2438,39 @@ class Ve extends Ce {
|
|
|
2438
2438
|
let P = 0;
|
|
2439
2439
|
for (let y = 1; y < u + 1; y++)
|
|
2440
2440
|
M = M.createNext(P), P += T;
|
|
2441
|
-
const
|
|
2441
|
+
const w = (e.x - o) / (f + 1);
|
|
2442
2442
|
for (let y = u + 1; y < _; y++)
|
|
2443
|
-
M = M.createNext(P), P +=
|
|
2443
|
+
M = M.createNext(P), P += w;
|
|
2444
2444
|
const k = new ht(0);
|
|
2445
2445
|
let I = k;
|
|
2446
|
-
const
|
|
2447
|
-
let
|
|
2446
|
+
const Z = e.y / (g - 1);
|
|
2447
|
+
let U = 0;
|
|
2448
2448
|
for (let y = 0; y < g - 1; y++)
|
|
2449
|
-
|
|
2450
|
-
const z = [],
|
|
2449
|
+
U += Z, I = I.createNext(U);
|
|
2450
|
+
const z = [], E = [], A = i.clone();
|
|
2451
2451
|
if (n) {
|
|
2452
2452
|
let y = 0;
|
|
2453
2453
|
this.m_Book.hasCover && (y = Math.floor(this.m_Book.coverPaperCount / 2));
|
|
2454
|
-
const
|
|
2455
|
-
A.left = 0, A.right = (this.getPX(y + 1, s) - this.getPX(y, s) +
|
|
2454
|
+
const R = Math.max(0.01, s);
|
|
2455
|
+
A.left = 0, A.right = (this.getPX(y + 1, s) - this.getPX(y, s) + R) / e.x, A.down = R / e.y, A.up = R / e.y;
|
|
2456
2456
|
}
|
|
2457
2457
|
const B = new le(a, A, !1);
|
|
2458
|
-
B.insert(p, k, z,
|
|
2459
|
-
const
|
|
2458
|
+
B.insert(p, k, z, E), p.updateIndex(0), k.updateIndex(0), pt(z, a.xSeams), pt(E, a.zSeams);
|
|
2459
|
+
const C = this.m_BindingVertexCount + 2, v = new Array(C);
|
|
2460
2460
|
a.xNoneSeamIndexes = v, M = p;
|
|
2461
|
-
for (let y = 0; y <
|
|
2461
|
+
for (let y = 0; y < C; y++) {
|
|
2462
2462
|
v[y] = M.index;
|
|
2463
2463
|
do
|
|
2464
2464
|
M = M.next;
|
|
2465
2465
|
while (M.seam);
|
|
2466
2466
|
}
|
|
2467
|
-
const N = p.getValues(),
|
|
2468
|
-
_ = N.length, g =
|
|
2469
|
-
const Y = _ * g, tt = [], q = new Array(Y).fill(0), O = [], x = [],
|
|
2467
|
+
const N = p.getValues(), b = k.getValues();
|
|
2468
|
+
_ = N.length, g = b.length;
|
|
2469
|
+
const Y = _ * g, tt = [], q = new Array(Y).fill(0), O = [], x = [], L = [], S = [];
|
|
2470
2470
|
Yt(
|
|
2471
2471
|
tt,
|
|
2472
2472
|
N,
|
|
2473
|
-
|
|
2473
|
+
b,
|
|
2474
2474
|
e,
|
|
2475
2475
|
i,
|
|
2476
2476
|
this.m_Book.direction
|
|
@@ -2479,10 +2479,10 @@ class Ve extends Ce {
|
|
|
2479
2479
|
let $ = B.rightNode.index, K = B.upNode.index;
|
|
2480
2480
|
$ === 0 && ($ = _ - 1), K === 0 && (K = g - 1);
|
|
2481
2481
|
for (let y = 0; y < g - 1; y++)
|
|
2482
|
-
for (let
|
|
2483
|
-
if (n && y >= G && y < K &&
|
|
2482
|
+
for (let R = 0; R < _ - 1; R++) {
|
|
2483
|
+
if (n && y >= G && y < K && R >= V && R < $)
|
|
2484
2484
|
continue;
|
|
2485
|
-
const it = y * _ +
|
|
2485
|
+
const it = y * _ + R, nt = y * _ + (R + 1), ct = (y + 1) * _ + R, ot = (y + 1) * _ + (R + 1);
|
|
2486
2486
|
q[it] += 2, q[nt] += 2, q[ct] += 2, q[ot] += 2, Qt(
|
|
2487
2487
|
O,
|
|
2488
2488
|
x,
|
|
@@ -2493,12 +2493,12 @@ class Ve extends Ce {
|
|
|
2493
2493
|
Y
|
|
2494
2494
|
);
|
|
2495
2495
|
}
|
|
2496
|
-
if (S.push(new Tt(0, 0, _ - 1, g - 1, !1, !1)), jt(S,
|
|
2496
|
+
if (S.push(new Tt(0, 0, _ - 1, g - 1, !1, !1)), jt(S, L, tt, _, g), a.baseXArray = N, a.baseZArray = b, a.baseVertexCount = Y, a.vertexCount = tt.length, a.texcoords = tt, a.weights = q, h) {
|
|
2497
2497
|
a.subMeshCount = 1;
|
|
2498
2498
|
const y = [];
|
|
2499
|
-
y.push(...O), y.push(...
|
|
2499
|
+
y.push(...O), y.push(...L), y.push(...x), a.triangles = y;
|
|
2500
2500
|
} else
|
|
2501
|
-
a.subMeshCount = 3, a.frontTriangles = O, a.backTriangles = x, a.borderTriangles =
|
|
2501
|
+
a.subMeshCount = 3, a.frontTriangles = O, a.backTriangles = x, a.borderTriangles = L;
|
|
2502
2502
|
return a.borders = S, a;
|
|
2503
2503
|
}
|
|
2504
2504
|
// ── updateRootPosition ────────────────────────────────────────────────
|
|
@@ -2513,9 +2513,9 @@ class Ve extends Ce {
|
|
|
2513
2513
|
let i = 0;
|
|
2514
2514
|
const n = e.length / 2 - 1, h = e.length / 2;
|
|
2515
2515
|
for (let P = 0; P < s; P++) {
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2518
|
-
const k =
|
|
2516
|
+
const w = e[P];
|
|
2517
|
+
w.updateTime();
|
|
2518
|
+
const k = w.zTime, I = w.thickness;
|
|
2519
2519
|
i += k * I, P === n && (i += k * this.m_BindingMidSpace / 2), P === h && (i += k * this.m_BindingMidSpace / 2);
|
|
2520
2520
|
}
|
|
2521
2521
|
let a = this.getStackHeight(t.index) - t.thickness / 2;
|
|
@@ -2532,16 +2532,16 @@ class Ve extends Ce {
|
|
|
2532
2532
|
let P = 0;
|
|
2533
2533
|
if (this.m_Book.alignToGround) {
|
|
2534
2534
|
_ = e[0].size.x;
|
|
2535
|
-
const
|
|
2536
|
-
g = H(i, 0,
|
|
2535
|
+
const w = this.m_StackHeight / 2;
|
|
2536
|
+
g = H(i, 0, w) - w, p = Math.sqrt(_ * _ - g * g), P = (Math.asin(p / _) * et - 90) * 2;
|
|
2537
2537
|
}
|
|
2538
2538
|
m = F(M, -P, l);
|
|
2539
2539
|
} else {
|
|
2540
2540
|
let P = 0;
|
|
2541
2541
|
if (this.m_Book.alignToGround) {
|
|
2542
2542
|
_ = e[0].size.x;
|
|
2543
|
-
const
|
|
2544
|
-
g =
|
|
2543
|
+
const w = this.m_StackHeight / 2;
|
|
2544
|
+
g = w - H(i, w, w * 2), p = Math.sqrt(_ * _ - g * g), P = (Math.asin(p / _) * et - 90) * 2;
|
|
2545
2545
|
}
|
|
2546
2546
|
m = F(P, -M, l);
|
|
2547
2547
|
}
|
|
@@ -2632,19 +2632,19 @@ class Ve extends Ce {
|
|
|
2632
2632
|
let e = new c.Vector3(0, 0, 0), s = new c.Vector3(0, 0, 0), i = this.m_BindingRadius * 0.6;
|
|
2633
2633
|
const n = this.m_StapleThickness * 0.5, h = t[0].thickness, a = this.m_Root.matrixWorld.clone(), o = t.length;
|
|
2634
2634
|
for (let u = 0; u < o; u++) {
|
|
2635
|
-
const l = t[u], m = l.transform, f = l.meshData.pattern, d = l.meshData.baseVertices, _ = f.baseXArray, g = f.baseZArray, p = _.length, M = g.length, T = this.m_BindingVertexCount + 1, P = l.thickness,
|
|
2636
|
-
let I = u,
|
|
2637
|
-
u >= Math.floor(o / 2) && (I = o - u - 1,
|
|
2638
|
-
const
|
|
2639
|
-
i = this.m_BindingRadius * F(0.45, 0.65, 1 -
|
|
2635
|
+
const l = t[u], m = l.transform, f = l.meshData.pattern, d = l.meshData.baseVertices, _ = f.baseXArray, g = f.baseZArray, p = _.length, M = g.length, T = this.m_BindingVertexCount + 1, P = l.thickness, w = f.xNoneSeamIndexes, k = m.position.clone();
|
|
2636
|
+
let I = u, Z = n;
|
|
2637
|
+
u >= Math.floor(o / 2) && (I = o - u - 1, Z *= -1);
|
|
2638
|
+
const U = (h + P) * 0.5 + P * (I - 1), z = m.matrixWorld.clone().invert().multiply(a), E = I / (o / 2);
|
|
2639
|
+
i = this.m_BindingRadius * F(0.45, 0.65, 1 - E);
|
|
2640
2640
|
for (let A = 0; A < M; A++) {
|
|
2641
|
-
const B = g[A],
|
|
2641
|
+
const B = g[A], C = new c.Vector3(0, 0, k.z + B), v = k.clone();
|
|
2642
2642
|
v.z += B;
|
|
2643
2643
|
const N = l.getDirection(B).multiplyScalar(i).add(v.clone());
|
|
2644
2644
|
if (u === 0 && A === 0) {
|
|
2645
|
-
const O = t[o - 1],
|
|
2646
|
-
|
|
2647
|
-
const S = O.getDirection(B).multiplyScalar(i).add(
|
|
2645
|
+
const O = t[o - 1], L = O.transform.position.clone().clone();
|
|
2646
|
+
L.z += B;
|
|
2647
|
+
const S = O.getDirection(B).multiplyScalar(i).add(L);
|
|
2648
2648
|
s = N.clone().sub(S).normalize(), e = new c.Vector3(
|
|
2649
2649
|
-s.y,
|
|
2650
2650
|
s.x,
|
|
@@ -2653,14 +2653,14 @@ class Ve extends Ce {
|
|
|
2653
2653
|
const V = Math.atan2(e.y, e.x) * et;
|
|
2654
2654
|
this.stapleMesh.rotation.set(0, 0, V * J);
|
|
2655
2655
|
}
|
|
2656
|
-
I > 0 &&
|
|
2657
|
-
const
|
|
2658
|
-
d[
|
|
2659
|
-
const Y =
|
|
2660
|
-
d[
|
|
2656
|
+
I > 0 && C.add(e.clone().multiplyScalar(U));
|
|
2657
|
+
const b = A * p;
|
|
2658
|
+
d[b] = C.clone().applyMatrix4(z), C.add(s.clone().multiplyScalar(Z));
|
|
2659
|
+
const Y = C.clone().applyMatrix4(z), tt = N.clone().applyMatrix4(z), q = v.clone().applyMatrix4(z);
|
|
2660
|
+
d[b + w[1]] = Y;
|
|
2661
2661
|
for (let O = 2; O < T; O++) {
|
|
2662
2662
|
const x = Q(1, T, O);
|
|
2663
|
-
d[
|
|
2663
|
+
d[b + w[O]] = Et(
|
|
2664
2664
|
Y,
|
|
2665
2665
|
tt,
|
|
2666
2666
|
q,
|
|
@@ -2721,7 +2721,7 @@ class ze {
|
|
|
2721
2721
|
return this.mesh;
|
|
2722
2722
|
}
|
|
2723
2723
|
}
|
|
2724
|
-
class
|
|
2724
|
+
class Ee extends ye {
|
|
2725
2725
|
constructor() {
|
|
2726
2726
|
super(...arguments), this.quality = 3, this.stapleSetup = new Ie();
|
|
2727
2727
|
}
|
|
@@ -2736,7 +2736,7 @@ class Le extends ye {
|
|
|
2736
2736
|
}
|
|
2737
2737
|
class Kt {
|
|
2738
2738
|
constructor(t) {
|
|
2739
|
-
this.x = (t == null ? void 0 : t.x) ?? 0, this.y = (t == null ? void 0 : t.y) ?? 0, this.width = (t == null ? void 0 : t.width) ?? 0, this.text = (t == null ? void 0 : t.text) ?? "", this.fontFamily = (t == null ? void 0 : t.fontFamily) ?? "Georgia", this.fontSize = (t == null ? void 0 : t.fontSize) ?? 24, this.fontWeight = (t == null ? void 0 : t.fontWeight) ?? "normal", this.fontStyle = (t == null ? void 0 : t.fontStyle) ?? "normal", this.color = (t == null ? void 0 : t.color) ?? "#222", this.lineHeight = (t == null ? void 0 : t.lineHeight) ?? 1.4, this.textAlign = (t == null ? void 0 : t.textAlign) ?? "left", this.opacity = (t == null ? void 0 : t.opacity) ?? 1, this.shadowColor = (t == null ? void 0 : t.shadowColor) ?? "", this.shadowBlur = (t == null ? void 0 : t.shadowBlur) ?? 0;
|
|
2739
|
+
this.x = (t == null ? void 0 : t.x) ?? 0, this.y = (t == null ? void 0 : t.y) ?? 0, this.width = (t == null ? void 0 : t.width) ?? 0, this.text = (t == null ? void 0 : t.text) ?? "", this.fontFamily = (t == null ? void 0 : t.fontFamily) ?? "Georgia", this.fontSize = (t == null ? void 0 : t.fontSize) ?? 24, this.fontWeight = (t == null ? void 0 : t.fontWeight) ?? "normal", this.fontStyle = (t == null ? void 0 : t.fontStyle) ?? "normal", this.color = (t == null ? void 0 : t.color) ?? "#222", this.lineHeight = (t == null ? void 0 : t.lineHeight) ?? 1.4, this.textAlign = (t == null ? void 0 : t.textAlign) ?? "left", this.opacity = (t == null ? void 0 : t.opacity) ?? 1, this.shadowColor = (t == null ? void 0 : t.shadowColor) ?? "", this.shadowBlur = (t == null ? void 0 : t.shadowBlur) ?? 0, this.shadowOffsetX = (t == null ? void 0 : t.shadowOffsetX) ?? 0, this.shadowOffsetY = (t == null ? void 0 : t.shadowOffsetY) ?? 0, this.textTransform = (t == null ? void 0 : t.textTransform) ?? "none", this.textDecoration = (t == null ? void 0 : t.textDecoration) ?? "none", this.background = (t == null ? void 0 : t.background) ?? "", this.backgroundPadding = (t == null ? void 0 : t.backgroundPadding) ?? 0, this.maxLines = (t == null ? void 0 : t.maxLines) ?? 0, this.height = (t == null ? void 0 : t.height) ?? 0, this.verticalAlign = (t == null ? void 0 : t.verticalAlign) ?? "top", this.rotation = (t == null ? void 0 : t.rotation) ?? 0;
|
|
2740
2740
|
}
|
|
2741
2741
|
_font() {
|
|
2742
2742
|
return `${this.fontStyle} ${this.fontWeight} ${this.fontSize}px ${this.fontFamily}`;
|
|
@@ -2747,35 +2747,53 @@ class Kt {
|
|
|
2747
2747
|
*/
|
|
2748
2748
|
wrapLines(t) {
|
|
2749
2749
|
if (!this.text) return [];
|
|
2750
|
-
|
|
2750
|
+
t.font = this._font();
|
|
2751
|
+
let e = this.text;
|
|
2752
|
+
if (this.textTransform === "uppercase" ? e = e.toUpperCase() : this.textTransform === "lowercase" ? e = e.toLowerCase() : this.textTransform === "capitalize" && (e = e.replace(/\b\w/g, (i) => i.toUpperCase())), this.width <= 0) {
|
|
2753
|
+
const i = e.split(`
|
|
2751
2754
|
`);
|
|
2752
|
-
|
|
2753
|
-
|
|
2755
|
+
return this._applyMaxLines(t, i);
|
|
2756
|
+
}
|
|
2757
|
+
const s = [];
|
|
2758
|
+
for (const i of e.split(`
|
|
2754
2759
|
`)) {
|
|
2755
|
-
if (
|
|
2756
|
-
|
|
2760
|
+
if (i === "") {
|
|
2761
|
+
s.push("");
|
|
2757
2762
|
continue;
|
|
2758
2763
|
}
|
|
2759
|
-
const
|
|
2760
|
-
let
|
|
2761
|
-
for (const
|
|
2762
|
-
const
|
|
2763
|
-
t.measureText(
|
|
2764
|
+
const n = i.split(/\s+/);
|
|
2765
|
+
let h = "";
|
|
2766
|
+
for (const a of n) {
|
|
2767
|
+
const o = h ? `${h} ${a}` : a;
|
|
2768
|
+
t.measureText(o).width > this.width && h ? (s.push(h), h = a) : h = o;
|
|
2764
2769
|
}
|
|
2765
|
-
|
|
2770
|
+
h && s.push(h);
|
|
2766
2771
|
}
|
|
2767
|
-
return
|
|
2772
|
+
return this._applyMaxLines(t, s);
|
|
2773
|
+
}
|
|
2774
|
+
_applyMaxLines(t, e) {
|
|
2775
|
+
if (this.maxLines <= 0 || e.length <= this.maxLines) return e;
|
|
2776
|
+
const s = e.slice(0, this.maxLines);
|
|
2777
|
+
let i = s[s.length - 1] + "…";
|
|
2778
|
+
if (this.width > 0)
|
|
2779
|
+
for (; t.measureText(i).width > this.width && i.length > 1; )
|
|
2780
|
+
i = i.slice(0, -2) + "…";
|
|
2781
|
+
return s[s.length - 1] = i, s;
|
|
2768
2782
|
}
|
|
2769
2783
|
/** Total rendered height in canvas pixels. */
|
|
2770
2784
|
measureHeight(t) {
|
|
2771
|
-
|
|
2785
|
+
const e = this.wrapLines(t);
|
|
2786
|
+
return (this.maxLines > 0 && e.length > this.maxLines ? this.maxLines : e.length) * this.fontSize * this.lineHeight;
|
|
2772
2787
|
}
|
|
2773
|
-
/**
|
|
2788
|
+
/**
|
|
2789
|
+
* Returns true if the point (px, py) is within the text bounding box.
|
|
2790
|
+
* Note: rotation is not accounted for — the hit area is always axis-aligned.
|
|
2791
|
+
*/
|
|
2774
2792
|
hitTest(t, e, s) {
|
|
2775
2793
|
const i = this.wrapLines(t);
|
|
2776
2794
|
if (i.length === 0) return !1;
|
|
2777
|
-
const n = i.length * this.fontSize * this.lineHeight, h = this.width > 0 ? this.width : this._maxLineWidth(t, i);
|
|
2778
|
-
return e >= this.x && e <= this.x +
|
|
2795
|
+
const n = i.length * this.fontSize * this.lineHeight, h = this.height > 0 ? this.height : n, a = this.width > 0 ? this.width : this._maxLineWidth(t, i);
|
|
2796
|
+
return e >= this.x && e <= this.x + a && s >= this.y && s <= this.y + h;
|
|
2779
2797
|
}
|
|
2780
2798
|
_maxLineWidth(t, e) {
|
|
2781
2799
|
t.font = this._font();
|
|
@@ -2790,11 +2808,37 @@ class Kt {
|
|
|
2790
2808
|
if (!this.text || this.opacity <= 0) return;
|
|
2791
2809
|
const e = this.wrapLines(t);
|
|
2792
2810
|
if (e.length === 0) return;
|
|
2793
|
-
t.save(), t.globalAlpha = this.opacity, t.font = this._font(), t.fillStyle = this.color, t.textBaseline = "top"
|
|
2794
|
-
const s = this.fontSize * this.lineHeight, i = this.width > 0 ? this.width : this._maxLineWidth(t, e);
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2811
|
+
t.save(), t.globalAlpha = this.opacity, t.font = this._font(), t.fillStyle = this.color, t.textBaseline = "top";
|
|
2812
|
+
const s = this.fontSize * this.lineHeight, i = this.width > 0 ? this.width : this._maxLineWidth(t, e), n = e.length * s, h = this.height > 0 ? this.height : n;
|
|
2813
|
+
if (this.rotation !== 0) {
|
|
2814
|
+
const o = this.x + i / 2, u = this.y + h / 2;
|
|
2815
|
+
t.translate(o, u), t.rotate(this.rotation), t.translate(-o, -u);
|
|
2816
|
+
}
|
|
2817
|
+
this.background && (t.fillStyle = this.background, t.fillRect(
|
|
2818
|
+
this.x - this.backgroundPadding,
|
|
2819
|
+
this.y - this.backgroundPadding,
|
|
2820
|
+
i + this.backgroundPadding * 2,
|
|
2821
|
+
h + this.backgroundPadding * 2
|
|
2822
|
+
), t.fillStyle = this.color), this.shadowColor && this.shadowBlur > 0 && (t.shadowColor = this.shadowColor, t.shadowBlur = this.shadowBlur, t.shadowOffsetX = this.shadowOffsetX, t.shadowOffsetY = this.shadowOffsetY);
|
|
2823
|
+
let a = this.y;
|
|
2824
|
+
this.height > 0 && this.verticalAlign !== "top" && (this.verticalAlign === "middle" ? a = this.y + (this.height - n) / 2 : this.verticalAlign === "bottom" && (a = this.y + this.height - n));
|
|
2825
|
+
for (let o = 0; o < e.length; o++) {
|
|
2826
|
+
let u = this.x;
|
|
2827
|
+
this.textAlign === "center" ? u = this.x + (i - t.measureText(e[o]).width) / 2 : this.textAlign === "right" && (u = this.x + i - t.measureText(e[o]).width);
|
|
2828
|
+
const l = a + o * s;
|
|
2829
|
+
if (t.fillText(e[o], u, l), this.textDecoration !== "none") {
|
|
2830
|
+
const m = t.shadowColor, f = t.shadowBlur;
|
|
2831
|
+
t.shadowColor = "", t.shadowBlur = 0;
|
|
2832
|
+
const d = t.measureText(e[o]).width;
|
|
2833
|
+
if (t.beginPath(), t.strokeStyle = this.color, t.lineWidth = 1, this.textDecoration === "underline") {
|
|
2834
|
+
const _ = l + this.fontSize + 2;
|
|
2835
|
+
t.moveTo(u, _), t.lineTo(u + d, _);
|
|
2836
|
+
} else if (this.textDecoration === "strikethrough") {
|
|
2837
|
+
const _ = l + this.fontSize * 0.55;
|
|
2838
|
+
t.moveTo(u, _), t.lineTo(u + d, _);
|
|
2839
|
+
}
|
|
2840
|
+
t.stroke(), t.shadowColor = m, t.shadowBlur = f;
|
|
2841
|
+
}
|
|
2798
2842
|
}
|
|
2799
2843
|
t.restore();
|
|
2800
2844
|
}
|
|
@@ -2811,7 +2855,7 @@ function Jt(r, t) {
|
|
|
2811
2855
|
});
|
|
2812
2856
|
}
|
|
2813
2857
|
function te(r, t) {
|
|
2814
|
-
t.x !== void 0 && (r.x = t.x), t.y !== void 0 && (r.y = t.y), t.width !== void 0 && (r.width = t.width), t.text !== void 0 && (r.text = t.text), t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), t.fontWeight !== void 0 && (r.fontWeight = t.fontWeight), t.fontStyle !== void 0 && (r.fontStyle = t.fontStyle), t.color !== void 0 && (r.color = t.color), t.lineHeight !== void 0 && (r.lineHeight = t.lineHeight), t.textAlign !== void 0 && (r.textAlign = t.textAlign), t.opacity !== void 0 && (r.opacity = t.opacity), t.shadowColor !== void 0 && (r.shadowColor = t.shadowColor), t.shadowBlur !== void 0 && (r.shadowBlur = t.shadowBlur);
|
|
2858
|
+
t.x !== void 0 && (r.x = t.x), t.y !== void 0 && (r.y = t.y), t.width !== void 0 && (r.width = t.width), t.text !== void 0 && (r.text = t.text), t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), t.fontWeight !== void 0 && (r.fontWeight = t.fontWeight), t.fontStyle !== void 0 && (r.fontStyle = t.fontStyle), t.color !== void 0 && (r.color = t.color), t.lineHeight !== void 0 && (r.lineHeight = t.lineHeight), t.textAlign !== void 0 && (r.textAlign = t.textAlign), t.opacity !== void 0 && (r.opacity = t.opacity), t.shadowColor !== void 0 && (r.shadowColor = t.shadowColor), t.shadowBlur !== void 0 && (r.shadowBlur = t.shadowBlur), t.shadowOffsetX !== void 0 && (r.shadowOffsetX = t.shadowOffsetX), t.shadowOffsetY !== void 0 && (r.shadowOffsetY = t.shadowOffsetY), t.textTransform !== void 0 && (r.textTransform = t.textTransform), t.textDecoration !== void 0 && (r.textDecoration = t.textDecoration), t.background !== void 0 && (r.background = t.background), t.backgroundPadding !== void 0 && (r.backgroundPadding = t.backgroundPadding), t.maxLines !== void 0 && (r.maxLines = t.maxLines), t.height !== void 0 && (r.height = t.height), t.verticalAlign !== void 0 && (r.verticalAlign = t.verticalAlign), t.rotation !== void 0 && (r.rotation = t.rotation);
|
|
2815
2859
|
}
|
|
2816
2860
|
class Ne {
|
|
2817
2861
|
constructor(t) {
|
|
@@ -3040,19 +3084,19 @@ export {
|
|
|
3040
3084
|
at as AutoTurnSetting,
|
|
3041
3085
|
ge as AutoTurnSettingCurveTimeMode,
|
|
3042
3086
|
fe as AutoTurnSettingMode,
|
|
3043
|
-
|
|
3044
|
-
|
|
3087
|
+
Zt as AutoTurnSettings,
|
|
3088
|
+
wt as Book,
|
|
3045
3089
|
ye as BookBinding,
|
|
3046
|
-
|
|
3047
|
-
|
|
3090
|
+
we as BookBound,
|
|
3091
|
+
Ze as BookContent,
|
|
3048
3092
|
j as BookDirection,
|
|
3049
3093
|
xe as BookHeightException,
|
|
3050
|
-
|
|
3094
|
+
Ue as BookPointerInteraction,
|
|
3051
3095
|
_e as BookRenderer,
|
|
3052
|
-
|
|
3096
|
+
Ct as Cylinder,
|
|
3053
3097
|
ce as MeshFactory,
|
|
3054
3098
|
Wt as PX_PER_UNIT,
|
|
3055
|
-
|
|
3099
|
+
Le as PageContent,
|
|
3056
3100
|
oe as Paper,
|
|
3057
3101
|
Tt as PaperBorder,
|
|
3058
3102
|
zt as PaperMaterialData,
|
|
@@ -3067,8 +3111,8 @@ export {
|
|
|
3067
3111
|
gt as PaperUVMargin,
|
|
3068
3112
|
ue as RendererFactory,
|
|
3069
3113
|
We as SpreadContent,
|
|
3070
|
-
|
|
3071
|
-
|
|
3114
|
+
Ut as SpritePageContent2,
|
|
3115
|
+
Ee as StapleBookBinding,
|
|
3072
3116
|
Ve as StapleBookBound,
|
|
3073
3117
|
Ie as StapleSetup,
|
|
3074
3118
|
Kt as TextBlock,
|