html-flip-book-vanilla 0.0.0-alpha.113 → 0.0.0-alpha.115
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/bookmarks.d.ts.map +1 -1
- package/dist/flip-book-options.d.ts +2 -0
- package/dist/flip-book-options.d.ts.map +1 -1
- package/dist/flipbook.d.ts +9 -0
- package/dist/flipbook.d.ts.map +1 -1
- package/dist/flipbook.js +146 -78
- package/dist/flipbook.js.map +1 -1
- package/dist/html-flip-book.css +1 -1
- package/dist/leaf.d.ts +1 -0
- package/dist/leaf.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bookmarks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookmarks.d.ts","sourceRoot":"","sources":["../src/bookmarks.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;AAG7F,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,MAAM,GAAG,WAAW;IAC/D,YAAY,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,SAAS,Q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AAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAe5E;IAGD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CA6B3E;IAED,OAAO,IAAI,IAAI,CAkBd;IAED,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,OAAO;IAoGf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,WAAW;IA6BnB,OAAO,CAAC,iBAAiB;IAmCzB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,OAAO;CAcf"}
|
|
@@ -23,6 +23,8 @@ export interface FlipBookOptions {
|
|
|
23
23
|
leafAspectRatio?: AspectRatio;
|
|
24
24
|
coverAspectRatio?: AspectRatio;
|
|
25
25
|
direction?: "rtl" | "ltr";
|
|
26
|
+
flipAxis?: "horizontal" | "vertical";
|
|
27
|
+
bindingSize?: number;
|
|
26
28
|
mouseMode?: MouseMode;
|
|
27
29
|
padding?: number;
|
|
28
30
|
pageSemantics?: PageSemantics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flip-book-options.d.ts","sourceRoot":"","sources":["../src/flip-book-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,a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AElE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAOlD,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAOjD,aAAa,CAAC,EAAE,aAAa,CAAC;IAM9B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAU/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAOtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAOhC,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAKrC,YAAY,CAAC,EAAE,MAAM,CAAC;IAOtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAMhC,cAAc,CAAC,EAAE,OAAO,CAAC;IAKzB,UAAU,CAAC,EAAE,OAAO,CAAC;IAQrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
package/dist/flipbook.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ declare class FlipBook {
|
|
|
12
12
|
private readonly leafAspectRatio;
|
|
13
13
|
private readonly coverAspectRatio;
|
|
14
14
|
private readonly direction;
|
|
15
|
+
private readonly flipAxis;
|
|
16
|
+
private readonly bindingSize;
|
|
15
17
|
private mouseMode;
|
|
16
18
|
private readonly fastDeltaThreshold;
|
|
17
19
|
private readonly initialTurnedLeaves;
|
|
@@ -54,6 +56,7 @@ declare class FlipBook {
|
|
|
54
56
|
private leaves;
|
|
55
57
|
private activeFlips;
|
|
56
58
|
private pendingFlipStartingPos;
|
|
59
|
+
private pendingFlipStartingClientX;
|
|
57
60
|
private pendingFlipStartingY;
|
|
58
61
|
private pendingFlipDirection;
|
|
59
62
|
private isDragging;
|
|
@@ -74,13 +77,18 @@ declare class FlipBook {
|
|
|
74
77
|
private debugTimer;
|
|
75
78
|
private debugBar;
|
|
76
79
|
private spineX;
|
|
80
|
+
private bindingY;
|
|
81
|
+
private turnZoneGesture;
|
|
77
82
|
private static readonly NO_FLIP_SELECTOR;
|
|
83
|
+
private static readonly VERTICAL_TURN_EDGE_RATIO;
|
|
78
84
|
private isInsideNoFlipZone;
|
|
85
|
+
private isPointInTurnZone;
|
|
79
86
|
private getSemanticForPage;
|
|
80
87
|
private buildPageFlipParams;
|
|
81
88
|
private syncHistoryAndNotifyFlipped;
|
|
82
89
|
private handlePopstate;
|
|
83
90
|
private get isLTR();
|
|
91
|
+
private get isVertical();
|
|
84
92
|
private get currentOrTurningLeaves();
|
|
85
93
|
constructor(options: FlipBookOptions);
|
|
86
94
|
private _tocPageIndex;
|
|
@@ -126,6 +134,7 @@ declare class FlipBook {
|
|
|
126
134
|
private onDragUpdate;
|
|
127
135
|
private getFoldPointerY;
|
|
128
136
|
private getSpineClientX;
|
|
137
|
+
private getBindingClientY;
|
|
129
138
|
private onDragEnd;
|
|
130
139
|
private handleTouchStart;
|
|
131
140
|
private handleTouchMove;
|
package/dist/flipbook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flipbook.d.ts","sourceRoot":"","sources":["../src/flipbook.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,iBAAiB,CAAC;AACzB,OAAO,mBAAmB,CAAC;AAI3B,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAInE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EACX,eAAe,EAGf,SAAS,EAGT,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAsDtD,cAAM,QAAQ;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA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EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,cAAc,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
package/dist/flipbook.js
CHANGED
|
@@ -608,7 +608,7 @@ var S = class {
|
|
|
608
608
|
for (let e of this.items.values()) this.applyMouseMode(e);
|
|
609
609
|
}
|
|
610
610
|
applyMouseMode(e) {
|
|
611
|
-
a(e.button, "data-mouse-mode", this.mouseMode), c(e.content, this.mouseMode === "turn"), c(e.reverse, this.mouseMode === "turn"), c(e.expanded, this.mouseMode === "turn");
|
|
611
|
+
a(e.button, "data-mouse-mode", this.mouseMode), c(e.content, this.mouseMode === "turn"), c(e.reverse, this.mouseMode === "turn"), c(e.expanded, this.mouseMode === "turn"), e.mouseMode = this.mouseMode;
|
|
612
612
|
}
|
|
613
613
|
refresh() {
|
|
614
614
|
this.refreshItems();
|
|
@@ -640,18 +640,34 @@ var S = class {
|
|
|
640
640
|
for (let [e, n] of this.items) t.has(e) || (this.motion.restore(e), n.button.removeEventListener("click", n.click), n.slot.remove(), n.reverse.remove(), n.expanded.remove(), this.items.delete(e));
|
|
641
641
|
}
|
|
642
642
|
placeItem(e, t, n, r, i, c) {
|
|
643
|
-
let l = this.items.get(e.id)?.edge, u = this.getItem(e, t, this.provider?.renderBookmark)
|
|
643
|
+
let l = this.items.get(e.id)?.edge, u = this.getItem(e, t, this.provider?.renderBookmark);
|
|
644
|
+
c || this.applyMouseMode(u);
|
|
645
|
+
let d = this.getLeafIndex(u.bookmark), f = this.itemsByLeaf.get(d) ?? [];
|
|
644
646
|
f.push(u), this.itemsByLeaf.set(d, f);
|
|
645
647
|
let p = u.bookmark;
|
|
646
|
-
|
|
647
|
-
let m =
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
648
|
+
u.edge = this.getEdge(p, t, n, r);
|
|
649
|
+
let m = this.isTurned(p, t), h = Math.floor((p.pageIndex + 1) / 2) === Math.floor((t.currentPageIndex + 1) / 2), g = JSON.stringify([
|
|
650
|
+
p.id,
|
|
651
|
+
p.pageIndex,
|
|
652
|
+
p.label,
|
|
653
|
+
p.className,
|
|
654
|
+
t.direction,
|
|
655
|
+
u.edge,
|
|
656
|
+
m,
|
|
657
|
+
h,
|
|
658
|
+
n,
|
|
659
|
+
this.provider?.attachment,
|
|
660
|
+
this.provider?.orientation
|
|
661
|
+
]);
|
|
662
|
+
if (!c || u.presentationKey !== g) {
|
|
663
|
+
a(u.button, "class", `flipbook-bookmark ${p.className ?? ""}`.trim()), a(u.button, "data-page-index", String(p.pageIndex)), a(u.button, "data-bookmark-id", p.id), a(u.button, "data-spread-index", String(Math.floor((p.pageIndex + 1) / 2))), a(u.button, "data-face", m ? "1" : "0"), a(u.button, "aria-label", p.label), a(u.button, "dir", t.direction), u.edge !== l && c?.add(e.id);
|
|
664
|
+
let r = u.edge === "left" || u.edge === "right";
|
|
665
|
+
s(u.button, this.provider?.attachment !== "pinned" && r && u.edge !== this.getLeafSide(p, t)), s(u.slot, !!u.button.hidden), a(u.button, "data-edge", u.edge), a(u.button, "data-orientation", this.provider?.orientation ?? "perpendicular"), a(u.slot, "data-edge", u.edge), a(u.slot, "data-orientation", this.provider?.orientation ?? "perpendicular"), r || this.clearStackSlot(u.slot), a(u.button, "data-leaf-index", String(this.getLeafIndex(p))), o(u.button, "--bookmark-slot", String(n + 1)), o(u.slot, "--bookmark-slot", String(n + 1)), a(u.button, "aria-current", h ? "page" : null), u.presentationKey = g;
|
|
666
|
+
}
|
|
667
|
+
let _ = this.getItemRail(u.edge, p, t);
|
|
668
|
+
if (_) {
|
|
669
|
+
let e = i.get(_), t = e ? e.nextSibling : _.firstChild;
|
|
670
|
+
t !== u.slot && _.insertBefore(u.slot, t), i.set(_, u.slot);
|
|
655
671
|
}
|
|
656
672
|
}
|
|
657
673
|
getItemRail(e, t, n) {
|
|
@@ -880,7 +896,7 @@ var S = class {
|
|
|
880
896
|
let s = o.bookmark !== i;
|
|
881
897
|
o.leaf = e, o.bookmark = i, o.reverseBookmark = a, o.renderer = n;
|
|
882
898
|
let c = this.provider?.renderExpandedBookmark;
|
|
883
|
-
return c && (s || o.expandedRenderer !== c || o.expanded.dataset.label !== i.label) ? (o.expanded.replaceChildren(c(i)), o.expanded.dataset.label = i.label) : !c && o.expanded.hasChildNodes() && o.expanded.replaceChildren(), o.expandedRenderer = c, this.applyMouseMode(o), o;
|
|
899
|
+
return c && (s || o.expandedRenderer !== c || o.expanded.dataset.label !== i.label) ? (o.expanded.replaceChildren(c(i)), o.expanded.dataset.label = i.label) : !c && o.expanded.hasChildNodes() && o.expanded.replaceChildren(), o.expandedRenderer = c, o.mouseMode !== this.mouseMode && this.applyMouseMode(o), o;
|
|
884
900
|
}
|
|
885
901
|
openPreview(e) {
|
|
886
902
|
e.expandedRenderer && e.button.dataset.bookmarkMotion !== "true" && this.preview.open(e.button, e.expanded, e.edge, this.provider?.className);
|
|
@@ -1207,6 +1223,10 @@ var U = 1.1, W = .9, G = class {
|
|
|
1207
1223
|
this.updatePosition(e), this.manualNeedsSettlement ||= t !== this.flipPosition, this.applyTransform(this.flipPosition);
|
|
1208
1224
|
}
|
|
1209
1225
|
setManualFold(e) {
|
|
1226
|
+
if (this.bookProperties.flipAxis === "vertical") {
|
|
1227
|
+
this.setManualPosition(Math.max(0, Math.min(1, 1 - e.y)));
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1210
1230
|
let t = this.getPaperSize();
|
|
1211
1231
|
if (!t) {
|
|
1212
1232
|
this.setManualPosition(Number.isFinite(e.x) ? (1 - e.x) / 2 : this.flipPosition);
|
|
@@ -1292,62 +1312,66 @@ var U = 1.1, W = .9, G = class {
|
|
|
1292
1312
|
let r = this.flipPosition, i = this.manualFoldPoint && { ...this.manualFoldPoint }, a = {
|
|
1293
1313
|
x: 1 - 2 * e,
|
|
1294
1314
|
y: this.foldOrigin < .5 ? 0 : 1
|
|
1295
|
-
}, o = Math.abs(e - r) * 180 / t * 1e3,
|
|
1296
|
-
let
|
|
1297
|
-
if (
|
|
1298
|
-
H(
|
|
1315
|
+
}, o = Math.abs(e - r), s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : o * 180 / t * 1e3, c = performance.now(), l = (t) => {
|
|
1316
|
+
let o = t - c;
|
|
1317
|
+
if (o < 0) {
|
|
1318
|
+
H(l);
|
|
1299
1319
|
return;
|
|
1300
1320
|
}
|
|
1301
|
-
let u = Math.min(
|
|
1321
|
+
let u = s === 0 ? 1 : Math.min(o / s, 1), d = V(u), f = r + d * (e - r);
|
|
1302
1322
|
i && (this.manualFoldPoint = {
|
|
1303
1323
|
x: i.x + d * (a.x - i.x),
|
|
1304
1324
|
y: i.y + d * (a.y - i.y)
|
|
1305
|
-
}, u === 1 && (e === 0 || e === 1) && (this.manualFoldPoint = void 0)), this.flipPosition = Math.max(0, Math.min(1, f)), this.applyTransform(f), u < 1 ? H(
|
|
1325
|
+
}, u === 1 && (e === 0 || e === 1) && (this.manualFoldPoint = void 0)), this.flipPosition = Math.max(0, Math.min(1, f)), this.applyTransform(f), u < 1 ? H(l) : (this.currentAnimation = null, this.targetFlipPosition = null, this.manualNeedsSettlement = !1, (this.flipPosition === 0 || this.flipPosition === 1) && this.onTurned(this.flipPosition === 1 ? A.Forward : A.Backward), this.endFlip(), n());
|
|
1306
1326
|
};
|
|
1307
|
-
H(
|
|
1327
|
+
H(l);
|
|
1308
1328
|
}), this.currentAnimation);
|
|
1309
1329
|
}
|
|
1310
1330
|
async efficientFlipToPosition(e, t = 2e4) {
|
|
1311
1331
|
return i(1, this.flipToPosition.bind(this))(e, t);
|
|
1312
1332
|
}
|
|
1313
1333
|
applyTransform(e) {
|
|
1314
|
-
let t = Math.max(0, Math.min(1, e)), { pageShadow: n } = this.bookProperties, r = t === 0 ? this.hoverShadow * .22 : t === 1 ? 1 - this.hoverShadow * .22 : t,
|
|
1315
|
-
if (this.paperShading !==
|
|
1316
|
-
this.paperShading =
|
|
1317
|
-
for (let e of this.pages) e && e.classList.contains("page--paper") !==
|
|
1318
|
-
}
|
|
1319
|
-
if (
|
|
1320
|
-
let e = z(
|
|
1321
|
-
x: this.manualFoldPoint.x *
|
|
1322
|
-
y: this.manualFoldPoint.y *
|
|
1334
|
+
let t = Math.max(0, Math.min(1, e)), { pageShadow: n } = this.bookProperties, r = this.bookProperties.flipAxis === "vertical", i = t === 0 ? this.hoverShadow * .22 : t === 1 ? 1 - this.hoverShadow * .22 : t, a = Number.parseFloat(this.pages[0].style.width), o = Number.parseFloat(this.pages[0].style.height), s = this.getPaperSize(), c = s !== void 0;
|
|
1335
|
+
if (this.paperShading !== c) {
|
|
1336
|
+
this.paperShading = c;
|
|
1337
|
+
for (let e of this.pages) e && e.classList.contains("page--paper") !== c && e.classList.toggle("page--paper", c);
|
|
1338
|
+
}
|
|
1339
|
+
if (!r && s && this.manualFoldPoint) {
|
|
1340
|
+
let e = z(a, o, {
|
|
1341
|
+
x: this.manualFoldPoint.x * a,
|
|
1342
|
+
y: this.manualFoldPoint.y * o
|
|
1323
1343
|
}, this.foldOrigin < .5 ? "top" : "bottom");
|
|
1324
1344
|
if (this.manualFoldPoint = {
|
|
1325
|
-
x: e.destination.x /
|
|
1326
|
-
y: e.destination.y /
|
|
1345
|
+
x: e.destination.x / a,
|
|
1346
|
+
y: e.destination.y / o
|
|
1327
1347
|
}, this.updatePosition((1 - this.manualFoldPoint.x) / 2), this.flipPosition > 0 && this.flipPosition < 1) {
|
|
1328
|
-
this.applyPaperFold(
|
|
1348
|
+
this.applyPaperFold(a, o, this.flipPosition, e);
|
|
1329
1349
|
return;
|
|
1330
1350
|
}
|
|
1331
1351
|
}
|
|
1332
|
-
if (
|
|
1333
|
-
this.applyPaperFold(
|
|
1352
|
+
if (!r && s && i > 0 && i < 1) {
|
|
1353
|
+
this.applyPaperFold(a, o, i, void 0, t === 1);
|
|
1334
1354
|
return;
|
|
1335
1355
|
}
|
|
1336
|
-
let
|
|
1356
|
+
let l = 0, u = 0;
|
|
1337
1357
|
if (n) {
|
|
1338
1358
|
let e = Math.sin(t * Math.PI), n = Math.max(e, this.hoverShadow);
|
|
1339
|
-
|
|
1359
|
+
l = Math.min(1, n * U), u = Math.min(1, n * W);
|
|
1340
1360
|
}
|
|
1341
|
-
this.pages.forEach((e,
|
|
1342
|
-
let
|
|
1361
|
+
this.pages.forEach((e, i) => {
|
|
1362
|
+
let a = this.bookProperties.isLTR;
|
|
1343
1363
|
if (!e) return;
|
|
1344
1364
|
e.classList.contains("page--folded") && e.classList.remove("page--folded", "page--angled-back"), e.style.clipPath = "", e.style.removeProperty("--fold-shading");
|
|
1345
|
-
let
|
|
1346
|
-
if (
|
|
1347
|
-
let
|
|
1348
|
-
|
|
1365
|
+
let o = i % 2 + 1 == 1, s, c, d;
|
|
1366
|
+
if (r) {
|
|
1367
|
+
let e = o ? t > .5 ? 180 - t * 180 : -t * 180 : t < .5 ? -t * 180 : 180 - t * 180;
|
|
1368
|
+
s = `translateY(${o ? "0px" : "-100%"}) rotateX(${e}deg) scaleY(${o ? t > .5 ? -1 : 1 : t < .5 ? -1 : 1})`, c = "top", d = "bottom";
|
|
1369
|
+
} else {
|
|
1370
|
+
let e = `${o ? a ? t > .5 ? 180 - t * 180 : -t * 180 : t > .5 ? -(180 - t * 180) : t * 180 : a ? t < .5 ? -t * 180 : 180 - t * 180 : t < .5 ? t * 180 : -(180 - t * 180)}deg`, n = `${o ? a ? "100%" : "-100%" : "0px"}`, r = o ? t > .5 ? -1 : 1 : t < .5 ? -1 : 1;
|
|
1371
|
+
c = o ? a ? "left" : "right" : a ? "right" : "left", s = `translateX(${n})rotateY(${e})scaleX(${r})`, d = c === "left" ? "right" : "left";
|
|
1349
1372
|
}
|
|
1350
|
-
|
|
1373
|
+
e.style.transform = s, e.style.transformOrigin = c, e.style.zIndex = this.getSurfaceZIndex(e, t, i, !1), n && (e.style.setProperty("--inner-shadow-shadow", l.toFixed(3)), e.style.setProperty("--inner-shadow-highlight", u.toFixed(3)), e.style.setProperty("--inner-shadow-edge", d));
|
|
1374
|
+
}), this.reportTransform(a, o, t);
|
|
1351
1375
|
}
|
|
1352
1376
|
reportTransform(e, t, n, r, i = !1) {
|
|
1353
1377
|
if (this.lastTransformWidth = e, this.lastTransformHeight = t, this.lastTransformPosition = n, this.lastTransformFold = r, this.lastBackwardPreview = i, this.wrappedTransformFrame = void 0, this.onTransform) {
|
|
@@ -1429,6 +1453,8 @@ var U = 1.1, W = .9, G = class {
|
|
|
1429
1453
|
height: 3.15
|
|
1430
1454
|
};
|
|
1431
1455
|
direction = "ltr";
|
|
1456
|
+
flipAxis = "horizontal";
|
|
1457
|
+
bindingSize = 64;
|
|
1432
1458
|
mouseMode = "turn";
|
|
1433
1459
|
fastDeltaThreshold = J;
|
|
1434
1460
|
initialTurnedLeaves = /* @__PURE__ */ new Set();
|
|
@@ -1471,6 +1497,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1471
1497
|
leaves = [];
|
|
1472
1498
|
activeFlips = /* @__PURE__ */ new Map();
|
|
1473
1499
|
pendingFlipStartingPos = 0;
|
|
1500
|
+
pendingFlipStartingClientX;
|
|
1474
1501
|
pendingFlipStartingY;
|
|
1475
1502
|
pendingFlipDirection = A.None;
|
|
1476
1503
|
isDragging = !1;
|
|
@@ -1491,10 +1518,20 @@ var U = 1.1, W = .9, G = class {
|
|
|
1491
1518
|
debugTimer;
|
|
1492
1519
|
debugBar;
|
|
1493
1520
|
spineX = 0;
|
|
1521
|
+
bindingY = 0;
|
|
1522
|
+
turnZoneGesture;
|
|
1494
1523
|
static NO_FLIP_SELECTOR = "[data-flipbook-no-flip]";
|
|
1524
|
+
static VERTICAL_TURN_EDGE_RATIO = .22;
|
|
1495
1525
|
isInsideNoFlipZone(t) {
|
|
1496
1526
|
return t instanceof Element && t.closest(e.NO_FLIP_SELECTOR) != null;
|
|
1497
1527
|
}
|
|
1528
|
+
isPointInTurnZone(t, n) {
|
|
1529
|
+
if (!(n instanceof Element)) return !1;
|
|
1530
|
+
let r = n.closest(".page");
|
|
1531
|
+
if (!(r instanceof HTMLElement)) return !1;
|
|
1532
|
+
let i = r.getBoundingClientRect();
|
|
1533
|
+
return i.height <= 0 ? !1 : t >= i.bottom - i.height * e.VERTICAL_TURN_EDGE_RATIO;
|
|
1534
|
+
}
|
|
1498
1535
|
getSemanticForPage(e) {
|
|
1499
1536
|
if (this.pageSemantics) return {
|
|
1500
1537
|
semanticName: this.pageSemantics.indexToSemanticName(e),
|
|
@@ -1540,6 +1577,9 @@ var U = 1.1, W = .9, G = class {
|
|
|
1540
1577
|
get isLTR() {
|
|
1541
1578
|
return this.direction === "ltr";
|
|
1542
1579
|
}
|
|
1580
|
+
get isVertical() {
|
|
1581
|
+
return this.flipAxis === "vertical";
|
|
1582
|
+
}
|
|
1543
1583
|
get currentOrTurningLeaves() {
|
|
1544
1584
|
let e = -1;
|
|
1545
1585
|
for (let t = this.leaves.length - 1; t >= 0; t--) {
|
|
@@ -1552,7 +1592,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1552
1592
|
return e === -1 ? [void 0, this.leaves[0]] : e === this.leaves.length ? [this.leaves[e - 1], void 0] : [this.leaves[e - 1], this.leaves[e]];
|
|
1553
1593
|
}
|
|
1554
1594
|
constructor(e) {
|
|
1555
|
-
this.pagesCount = e.pagesCount, this.leafAspectRatio = e.leafAspectRatio || this.leafAspectRatio, this.coverAspectRatio = e.coverAspectRatio || this.coverAspectRatio, this.direction = e.direction || this.direction, this.mouseMode = e.mouseMode ?? "turn", this.fastDeltaThreshold = e.fastDeltaThreshold ?? this.fastDeltaThreshold, this.initialTurnedLeaves = new Set(e.initialTurnedLeaves ?? []), this.pageSemantics = e.pageSemantics, this.bookmarkProvider = e.bookmarkProvider, this.bookmarksEnabled = e.enableBookmarks ?? !1, this.onPageChanged = e.onPageChanged, this.onLeafFlipActivity = e.onLeafFlipActivity, this.onPageFlipping = e.onPageFlipping, this.onPageFlipped = e.onPageFlipped, this.historyMapper = e.enableHistory === !1 ? void 0 : e.historyMapper ?? k(e.pageSemantics), this.leavesBuffer = e.leavesBuffer, this.keepPageContentLayout = e.keepPageContentLayout === !0 && e.leavesBuffer != null, this.coverPageIndices = e.coverPageIndices, this.downloadEnabled = e.enableDownload !== !1, this.downloadConfig = void 0, this.setDownloadConfig(e.downloadConfig), this.pageShadow = e.pageShadow ?? !0, this.snapshotDuringFlip = e.snapshotDuringFlip ?? !0, this._tocPageIndex = e.tocPageIndex ?? 4, n(this._tocPageIndex);
|
|
1595
|
+
this.pagesCount = e.pagesCount, this.leafAspectRatio = e.leafAspectRatio || this.leafAspectRatio, this.coverAspectRatio = e.coverAspectRatio || this.coverAspectRatio, this.direction = e.direction || this.direction, this.flipAxis = e.flipAxis || this.flipAxis, this.bindingSize = e.bindingSize !== void 0 && Number.isFinite(e.bindingSize) ? Math.max(0, e.bindingSize) : this.bindingSize, this.mouseMode = e.mouseMode ?? "turn", this.fastDeltaThreshold = e.fastDeltaThreshold ?? this.fastDeltaThreshold, this.initialTurnedLeaves = new Set(e.initialTurnedLeaves ?? []), this.pageSemantics = e.pageSemantics, this.bookmarkProvider = e.bookmarkProvider, this.bookmarksEnabled = e.enableBookmarks ?? !1, this.onPageChanged = e.onPageChanged, this.onLeafFlipActivity = e.onLeafFlipActivity, this.onPageFlipping = e.onPageFlipping, this.onPageFlipped = e.onPageFlipped, this.historyMapper = e.enableHistory === !1 ? void 0 : e.historyMapper ?? k(e.pageSemantics), this.leavesBuffer = e.leavesBuffer, this.keepPageContentLayout = e.keepPageContentLayout === !0 && e.leavesBuffer != null, this.coverPageIndices = e.coverPageIndices, this.downloadEnabled = e.enableDownload !== !1, this.downloadConfig = void 0, this.setDownloadConfig(e.downloadConfig), this.pageShadow = e.pageShadow ?? !0, this.snapshotDuringFlip = e.snapshotDuringFlip ?? !0, this._tocPageIndex = e.tocPageIndex ?? 4, n(this._tocPageIndex);
|
|
1556
1596
|
}
|
|
1557
1597
|
_tocPageIndex = 4;
|
|
1558
1598
|
getTocPageIndex() {
|
|
@@ -1604,7 +1644,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1604
1644
|
return e && t && !t.isCollapsed && (e.contains(t.anchorNode) || e.contains(t.focusNode)) ? t : null;
|
|
1605
1645
|
}
|
|
1606
1646
|
handlePageMouseDown = (e) => {
|
|
1607
|
-
this.cancelHoverUpdates(), this._suppressNextClick = !1, (e.type === "mousedown" || e.pointerType === "mouse") && (this.gestureStartedInNoFlipZone = this.isInsideNoFlipZone(e.target), this.gestureStartedInNoFlipZone && this.clearHoverShadow(), this.mouseMode === "turn" && e instanceof MouseEvent && e.button === 0 && !this.gestureStartedInNoFlipZone && (this.getBookSelection()?.removeAllRanges(), this.bookElement?.classList.remove("flipbook--preserve-selection"))), this.mouseMode === "select" && e instanceof MouseEvent && e.button === 0 && (e.type !== "pointerdown" || e.pointerType === "mouse") && e.stopPropagation();
|
|
1647
|
+
this.cancelHoverUpdates(), this._suppressNextClick = !1, (e.type === "mousedown" || e.pointerType === "mouse") && (this.gestureStartedInNoFlipZone = this.isInsideNoFlipZone(e.target), this.isVertical && (this.turnZoneGesture = this.isPointInTurnZone(e.clientY, e.target)), this.gestureStartedInNoFlipZone && this.clearHoverShadow(), this.mouseMode === "turn" && e instanceof MouseEvent && e.button === 0 && !this.gestureStartedInNoFlipZone && (this.getBookSelection()?.removeAllRanges(), this.bookElement?.classList.remove("flipbook--preserve-selection"))), this.mouseMode === "select" && e instanceof MouseEvent && e.button === 0 && (e.type !== "pointerdown" || e.pointerType === "mouse") && e.stopPropagation();
|
|
1608
1648
|
};
|
|
1609
1649
|
handlePageSelectStart = (e) => {
|
|
1610
1650
|
this.snapshotDuringFlip && e.currentTarget instanceof HTMLElement && e.currentTarget.classList.contains("page--flipping") && e.preventDefault();
|
|
@@ -1673,19 +1713,21 @@ var U = 1.1, W = .9, G = class {
|
|
|
1673
1713
|
this.bookmarkClearance = Object.values(t).join();
|
|
1674
1714
|
let n = this.bookElement.clientWidth, r = Math.max(0, n - t.left - t.right), i = Math.max(0, this.bookElement.clientHeight - t.top - t.bottom);
|
|
1675
1715
|
this.spineX = t.left + r / 2;
|
|
1676
|
-
let a =
|
|
1677
|
-
this.
|
|
1678
|
-
let s = r, c =
|
|
1716
|
+
let a = this.isVertical, o = a ? i / 2 : i;
|
|
1717
|
+
this.bindingY = a ? t.top + o : t.top + this.bindingSize;
|
|
1718
|
+
let s = (a ? new q(r, o) : new q(r / 2, i)).aspectRatioFit(this.coverAspectRatio), c = new q(s.width * this.leafAspectRatio.width / this.coverAspectRatio.width, s.height * this.leafAspectRatio.height / this.coverAspectRatio.height);
|
|
1719
|
+
this.bookElement.style.perspective = `${Math.min(c.width * 2, c.height) * 2}px`, this.bookElement.style.setProperty("--flipbook-binding-size", a ? `${this.bindingSize}px` : "0px"), this.bookElement.style.setProperty("--flipbook-binding-y", `${this.bindingY}px`);
|
|
1720
|
+
let l = r, u = i;
|
|
1679
1721
|
for (let e of this.pageElements) {
|
|
1680
|
-
let n = e.dataset.isCoverPage === "1" ?
|
|
1681
|
-
e.style.width = `${n.width}px`, e.style.height = `${n.height}px`, e.style[this.isLTR ? "left" : "right"] = `${(this.isLTR ? t.left : t.right) + (
|
|
1722
|
+
let n = e.dataset.isCoverPage === "1" ? s : c;
|
|
1723
|
+
e.style.width = `${n.width}px`, e.style.height = `${n.height}px`, a ? (e.style.left = `${t.left + (l - n.width) / 2}px`, e.style.top = `${this.bindingY}px`) : (e.style[this.isLTR ? "left" : "right"] = `${(this.isLTR ? t.left : t.right) + (l - 2 * n.width) / 2}px`, e.style.top = `${t.top + (u - n.height) / 2}px`);
|
|
1682
1724
|
}
|
|
1683
|
-
let
|
|
1725
|
+
let d = this.getBookmarkProvider()?.attachment === "pinned" && this.pageElements.some((e) => e.dataset.isCoverPage === "1") ? s : c;
|
|
1684
1726
|
this.bookmarksEnabled && this.bookmarkLayer?.layout({
|
|
1685
|
-
left: t.left + (
|
|
1686
|
-
top: t.top + (
|
|
1687
|
-
width: 2 *
|
|
1688
|
-
height:
|
|
1727
|
+
left: t.left + (l - (a ? 1 : 2) * d.width) / 2,
|
|
1728
|
+
top: a ? this.bindingY : t.top + (u - d.height) / 2,
|
|
1729
|
+
width: (a ? 1 : 2) * d.width,
|
|
1730
|
+
height: d.height
|
|
1689
1731
|
}, n, e);
|
|
1690
1732
|
for (let e of this.leaves) e.applyTransform(e.flipPosition);
|
|
1691
1733
|
}
|
|
@@ -1699,7 +1741,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1699
1741
|
render(e, t = !1) {
|
|
1700
1742
|
let n = typeof e == "string" ? document.querySelector(e) : e;
|
|
1701
1743
|
if (!n) throw Error(typeof e == "string" ? `Couldn't find container with selector: ${e}` : "Couldn't find container element");
|
|
1702
|
-
this.cancelHoverUpdates(), this.cancelPendingManualPose(), this.contentPreparationHolds.clear(), this.cancelContentPreparation(), this.unwatchPreparationInput(), this.restoreContentMasks(), this.preparedContent = /* @__PURE__ */ new WeakSet(), this.bufferContentInitialized = !1, this.bookElement = n, this.keepPageContentLayout && (this.preparationDocument = this.bookElement.ownerDocument, this.preparationDocument.addEventListener("pointerdown", this.prioritizePreparationInput, !0), this.preparationDocument.addEventListener("keydown", this.deferPreparationForInput, !0), this.preparationDocument.addEventListener("pointerup", this.releasePreparationInput, !0), this.preparationDocument.addEventListener("pointercancel", this.releasePreparationInput, !0), this.preparationDocument.defaultView?.addEventListener("blur", this.releasePreparationInput)), this.setMouseMode(this.mouseMode), this.bookElement.classList.contains("flipbook") || this.bookElement.classList.add("flipbook"), this.pageShadow || this.bookElement.classList.add("flipbook--no-page-shadow");
|
|
1744
|
+
this.cancelHoverUpdates(), this.cancelPendingManualPose(), this.contentPreparationHolds.clear(), this.cancelContentPreparation(), this.unwatchPreparationInput(), this.restoreContentMasks(), this.preparedContent = /* @__PURE__ */ new WeakSet(), this.bufferContentInitialized = !1, this.bookElement = n, this.keepPageContentLayout && (this.preparationDocument = this.bookElement.ownerDocument, this.preparationDocument.addEventListener("pointerdown", this.prioritizePreparationInput, !0), this.preparationDocument.addEventListener("keydown", this.deferPreparationForInput, !0), this.preparationDocument.addEventListener("pointerup", this.releasePreparationInput, !0), this.preparationDocument.addEventListener("pointercancel", this.releasePreparationInput, !0), this.preparationDocument.defaultView?.addEventListener("blur", this.releasePreparationInput)), this.setMouseMode(this.mouseMode), this.bookElement.classList.contains("flipbook") || this.bookElement.classList.add("flipbook"), this.bookElement.classList.toggle("flipbook--vertical", this.isVertical), this.pageShadow || this.bookElement.classList.add("flipbook--no-page-shadow");
|
|
1703
1745
|
let i = n.querySelectorAll(".page");
|
|
1704
1746
|
if (!i.length) throw Error("No pages found in flipbook");
|
|
1705
1747
|
this.pageElements = Array.from(i);
|
|
@@ -1742,6 +1784,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1742
1784
|
let n = Math.floor(t / 2), r = (t + 1) % 2 == 1, i = this.initialTurnedLeaves.has(n);
|
|
1743
1785
|
if (e.classList.add(r ? "odd" : "even"), r) this.leaves[n] = new G(n, [e, void 0], i, {
|
|
1744
1786
|
isLTR: this.isLTR,
|
|
1787
|
+
flipAxis: this.flipAxis,
|
|
1745
1788
|
leavesCount: a,
|
|
1746
1789
|
pagesCount: this.pagesCount,
|
|
1747
1790
|
pageShadow: this.pageShadow,
|
|
@@ -1935,7 +1978,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
1935
1978
|
let n = Number.isFinite(t.deltaX) ? Math.abs(t.deltaX) : 0, r = Number.isFinite(t.deltaY) ? Math.abs(t.deltaY) : 0;
|
|
1936
1979
|
Math.max(n, r) > e.DIRECTION_LOCK_THRESHOLD && (this.touchDirectionLock = n >= r ? "horizontal" : "vertical");
|
|
1937
1980
|
}
|
|
1938
|
-
(this.touchDirectionLock
|
|
1981
|
+
(this.isVertical ? this.touchDirectionLock === "horizontal" : this.touchDirectionLock === "vertical") && t.pointerType !== "mouse" || (!n && (this.gestureStartedInNoFlipZone ?? this.isInsideNoFlipZone(t.srcEvent?.target ?? null)) ? this.gestureStartedInNoFlipZone = !0 : this.isVertical && !n && (this.turnZoneGesture === void 0 && (this.turnZoneGesture = this.isPointInTurnZone(Number.isFinite(t.center.y) ? t.center.y : 0, t.srcEvent?.target ?? null)), this.turnZoneGesture === !1) || (this.currentManualFlip ? (this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingClientX = void 0, this.pendingFlipStartingY = void 0) : (this.isDragging = !0, this.pendingFlipStartingPos = this.isVertical ? t.center.y - (Number.isFinite(t.deltaY) ? t.deltaY : 0) : t.center.x - (Number.isFinite(t.deltaX) ? t.deltaX : 0), this.pendingFlipStartingClientX = Number.isFinite(t.center.x) ? t.center.x - (Number.isFinite(t.deltaX) ? t.deltaX : 0) : void 0, this.pendingFlipStartingY = Number.isFinite(t.center.y) ? t.center.y - (Number.isFinite(t.deltaY) ? t.deltaY : 0) : void 0, this.pendingFlipDirection = A.None, (Number.isFinite(t.deltaX) && t.deltaX !== 0 || Number.isFinite(t.deltaY) && t.deltaY !== 0) && this.onDragUpdate(t, n))));
|
|
1939
1982
|
}
|
|
1940
1983
|
queueManualDragUpdate(e, t = !1) {
|
|
1941
1984
|
let n = this.currentManualFlip;
|
|
@@ -1953,16 +1996,16 @@ var U = 1.1, W = .9, G = class {
|
|
|
1953
1996
|
this.manualPoseFrame !== void 0 && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.manualPoseFrame), this.manualPoseFrame = void 0, this.pendingManualPose = void 0;
|
|
1954
1997
|
}
|
|
1955
1998
|
onDragUpdate(e, t = !1) {
|
|
1956
|
-
if (this.gestureStartedInNoFlipZone || this.touchDirectionLock === "vertical" && e.pointerType !== "mouse") return;
|
|
1999
|
+
if (this.gestureStartedInNoFlipZone || (this.isVertical ? this.touchDirectionLock === "horizontal" : this.touchDirectionLock === "vertical") && e.pointerType !== "mouse") return;
|
|
1957
2000
|
let n = this.currentManualFlip;
|
|
1958
2001
|
if (!t && !n && (this.gestureStartedInNoFlipZone ?? this.isInsideNoFlipZone(e.srcEvent?.target ?? null))) return;
|
|
1959
|
-
let r = e.center.x;
|
|
2002
|
+
let r = this.isVertical ? e.center.y : e.center.x;
|
|
1960
2003
|
if (!this.bookElement) return;
|
|
1961
|
-
let i = n ? void 0 : this.bookElement.clientWidth;
|
|
2004
|
+
let i = n ? void 0 : this.isVertical ? this.bookElement.clientHeight : this.bookElement.clientWidth;
|
|
1962
2005
|
if (i === 0) return;
|
|
1963
|
-
let a = n?.startingPos ?? this.pendingFlipStartingPos, o = this.isLTR ? a - r : r - a, s = Number.isFinite(e.center.y) && this.pendingFlipStartingY !== void 0 ? e.center.y - this.pendingFlipStartingY : 0;
|
|
2006
|
+
let a = n?.startingPos ?? this.pendingFlipStartingPos, o = this.isVertical || this.isLTR ? a - r : r - a, s = this.isVertical ? Number.isFinite(e.center.x) && this.pendingFlipStartingClientX !== void 0 ? e.center.x - this.pendingFlipStartingClientX : 0 : Number.isFinite(e.center.y) && this.pendingFlipStartingY !== void 0 ? e.center.y - this.pendingFlipStartingY : 0;
|
|
1964
2007
|
if (!n && o === 0 && (!this.isDragging || s === 0 || e.pointerType === "touch")) return;
|
|
1965
|
-
let c = n?.direction ?? (this.pendingFlipDirection === A.None ? o === 0 ? this.isLTR === a >= this.getSpineClientX() ? A.Forward : A.Backward : o > 0 ? A.Forward : A.Backward : this.pendingFlipDirection);
|
|
2008
|
+
let c = n?.direction ?? (this.pendingFlipDirection === A.None ? o === 0 ? this.isVertical ? a >= this.getBindingClientY() ? A.Forward : A.Backward : this.isLTR === a >= this.getSpineClientX() ? A.Forward : A.Backward : o > 0 ? A.Forward : A.Backward : this.pendingFlipDirection);
|
|
1966
2009
|
if (this.pendingFlipDirection === A.None && (this.pendingFlipDirection = c), !n) {
|
|
1967
2010
|
for (let e of this.activeFlips.values()) if (e.isDuringAutoFlip && e.direction !== c) return;
|
|
1968
2011
|
}
|
|
@@ -1982,17 +2025,17 @@ var U = 1.1, W = .9, G = class {
|
|
|
1982
2025
|
}
|
|
1983
2026
|
n.delta = o;
|
|
1984
2027
|
let l = n.direction === A.Backward ? n.leaf.pages[1] ?? n.leaf.pages[0] : n.leaf.pages[0], u = Number.parseFloat(l.style.width), d = Number.parseFloat(l.style.height), f = Number.isFinite(u) && u > 0 && Number.isFinite(d) && d > 0, p = n.leaf.pages.some((e) => e?.dataset.isCoverPage === "1");
|
|
1985
|
-
if (f && !p && n.leaf.pages[1]) {
|
|
2028
|
+
if (!this.isVertical && f && !p && n.leaf.pages[1]) {
|
|
1986
2029
|
let t = Number.isFinite(e.center.y) && n.startingY !== void 0 ? e.center.y - n.startingY : 0;
|
|
1987
2030
|
n.leaf.setManualFold({
|
|
1988
2031
|
x: (n.direction === A.Forward ? 1 : -1) - o / u,
|
|
1989
2032
|
y: (n.cornerY ?? 1) + t / d
|
|
1990
2033
|
});
|
|
1991
2034
|
} else {
|
|
1992
|
-
let e = Number.isFinite(
|
|
1993
|
-
if (
|
|
1994
|
-
let
|
|
1995
|
-
n.leaf.setManualPosition(Math.max(0, Math.min(1,
|
|
2035
|
+
let e = this.isVertical ? d : u, t = Number.isFinite(e) && e > 0 ? e * 2 : i ?? this.bookElement.clientWidth;
|
|
2036
|
+
if (t <= 0) return;
|
|
2037
|
+
let r = n.direction === A.Forward ? o / t : 1 + o / t;
|
|
2038
|
+
n.leaf.setManualPosition(Math.max(0, Math.min(1, r)));
|
|
1996
2039
|
}
|
|
1997
2040
|
}
|
|
1998
2041
|
getFoldPointerY(e, t, n) {
|
|
@@ -2007,28 +2050,34 @@ var U = 1.1, W = .9, G = class {
|
|
|
2007
2050
|
let t = e.getBoundingClientRect(), n = t.width > 0 && e.clientWidth > 0 ? t.width / e.clientWidth : 1;
|
|
2008
2051
|
return t.left + this.spineX * n;
|
|
2009
2052
|
}
|
|
2053
|
+
getBindingClientY() {
|
|
2054
|
+
let e = this.bookElement;
|
|
2055
|
+
if (!e) return this.bindingY;
|
|
2056
|
+
let t = e.getBoundingClientRect(), n = t.height > 0 && e.clientHeight > 0 ? t.height / e.clientHeight : 1;
|
|
2057
|
+
return t.top + this.bindingY * n;
|
|
2058
|
+
}
|
|
2010
2059
|
onDragEnd(e, t = !1) {
|
|
2011
|
-
this.flushPendingManualPose(), this.gestureStartedInNoFlipZone = void 0, this._suppressNextClick = !0;
|
|
2060
|
+
this.flushPendingManualPose(), this.gestureStartedInNoFlipZone = void 0, this.turnZoneGesture = void 0, this._suppressNextClick = !0;
|
|
2012
2061
|
let n = this.currentManualFlip;
|
|
2013
2062
|
if (!n) {
|
|
2014
|
-
this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingY = void 0, this.isDragging = !1, this.clearHoverShadow();
|
|
2063
|
+
this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingClientX = void 0, this.pendingFlipStartingY = void 0, this.isDragging = !1, this.clearHoverShadow();
|
|
2015
2064
|
return;
|
|
2016
2065
|
}
|
|
2017
|
-
let r = e.velocityX * 1e3, i;
|
|
2066
|
+
let r = (this.isVertical ? e.velocityY : e.velocityX) * 1e3, i = this.isVertical || this.isLTR ? r < -this.fastDeltaThreshold : r > this.fastDeltaThreshold, a = this.isVertical || this.isLTR ? r > this.fastDeltaThreshold : r < -this.fastDeltaThreshold, o;
|
|
2018
2067
|
switch (n.direction) {
|
|
2019
2068
|
case A.Forward:
|
|
2020
|
-
|
|
2069
|
+
o = !t && (i || n.leaf.flipPosition >= .5) ? 1 : 0;
|
|
2021
2070
|
break;
|
|
2022
2071
|
case A.Backward:
|
|
2023
|
-
|
|
2072
|
+
o = !t && (a || n.leaf.flipPosition <= .5) ? 0 : 1;
|
|
2024
2073
|
break;
|
|
2025
2074
|
default:
|
|
2026
|
-
n.leaf.endFlip(), this.activeFlips.delete(n.leaf.index), this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingY = void 0, this.isDragging = !1, this.scheduleContentPreparation();
|
|
2075
|
+
n.leaf.endFlip(), this.activeFlips.delete(n.leaf.index), this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingClientX = void 0, this.pendingFlipStartingY = void 0, this.isDragging = !1, this.scheduleContentPreparation();
|
|
2027
2076
|
return;
|
|
2028
2077
|
}
|
|
2029
|
-
n.isDuringAutoFlip = !0, this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingY = void 0, this.isDragging = !1;
|
|
2030
|
-
let
|
|
2031
|
-
this.lastFlipParams = this.buildPageFlipParams(
|
|
2078
|
+
n.isDuringAutoFlip = !0, this.pendingFlipDirection = A.None, this.pendingFlipStartingPos = 0, this.pendingFlipStartingClientX = void 0, this.pendingFlipStartingY = void 0, this.isDragging = !1;
|
|
2079
|
+
let s = Math.max(0, 2 * n.leaf.index + (o === 1 ? 1 : -1)), c = o === 1 ? "forward" : "backward";
|
|
2080
|
+
this.lastFlipParams = this.buildPageFlipParams(s, c), this.onPageFlipping && this.onPageFlipping(this.lastFlipParams), n.leaf.flipToPosition(o).then(() => {
|
|
2032
2081
|
n.leaf.endFlip(), this.activeFlips.delete(n.leaf.index), this.scheduleContentPreparation();
|
|
2033
2082
|
});
|
|
2034
2083
|
}
|
|
@@ -2038,7 +2087,7 @@ var U = 1.1, W = .9, G = class {
|
|
|
2038
2087
|
this.touchStartingPos = {
|
|
2039
2088
|
x: t.pageX,
|
|
2040
2089
|
y: t.pageY
|
|
2041
|
-
}, this.touchStartedInNoFlipZone = this.isInsideNoFlipZone(e.target), this.gestureStartedInNoFlipZone = this.touchStartedInNoFlipZone, this.touchDirectionLock = "none";
|
|
2090
|
+
}, this.touchStartedInNoFlipZone = this.isInsideNoFlipZone(e.target), this.gestureStartedInNoFlipZone = this.touchStartedInNoFlipZone, this.turnZoneGesture = this.isVertical ? this.isPointInTurnZone(t.clientY, e.target) : void 0, this.touchDirectionLock = "none";
|
|
2042
2091
|
};
|
|
2043
2092
|
handleTouchMove = (t) => {
|
|
2044
2093
|
if (t.touches.length > 1 || this.touchStartedInNoFlipZone) return;
|
|
@@ -2047,7 +2096,10 @@ var U = 1.1, W = .9, G = class {
|
|
|
2047
2096
|
let t = Math.abs(r), n = Math.abs(i);
|
|
2048
2097
|
(t > e.DIRECTION_LOCK_THRESHOLD || n > e.DIRECTION_LOCK_THRESHOLD) && (this.touchDirectionLock = t >= n ? "horizontal" : "vertical");
|
|
2049
2098
|
}
|
|
2050
|
-
this.
|
|
2099
|
+
if (this.isVertical) {
|
|
2100
|
+
if (this.turnZoneGesture === !1) return;
|
|
2101
|
+
this.touchDirectionLock === "vertical" && t.preventDefault();
|
|
2102
|
+
} else this.touchDirectionLock === "horizontal" && t.preventDefault();
|
|
2051
2103
|
};
|
|
2052
2104
|
canPreviewHover(e) {
|
|
2053
2105
|
return !(this.isInsideNoFlipZone(e.target) || this.mouseMode === "select" || e.buttons !== 0 || this.isDragging || this.currentManualFlip || this.activeFlips.size > 0);
|
|
@@ -2072,7 +2124,23 @@ var U = 1.1, W = .9, G = class {
|
|
|
2072
2124
|
this.clearHoverShadow();
|
|
2073
2125
|
return;
|
|
2074
2126
|
}
|
|
2075
|
-
let n = (e.clientX - t.left) * this.bookElement.clientWidth / t.width, r = (e.clientY - t.top) * this.bookElement.clientHeight / t.height
|
|
2127
|
+
let n = (e.clientX - t.left) * this.bookElement.clientWidth / t.width, r = (e.clientY - t.top) * this.bookElement.clientHeight / t.height;
|
|
2128
|
+
if (this.isVertical) {
|
|
2129
|
+
let e = this.getNextAvailableLeaf(A.Forward);
|
|
2130
|
+
if (!e) {
|
|
2131
|
+
this.clearHoverShadow();
|
|
2132
|
+
return;
|
|
2133
|
+
}
|
|
2134
|
+
let t = e.pages[0], i = Number.parseFloat(t.style.width), a = Number.parseFloat(t.style.height), o = Number.parseFloat(t.style.top), s = Number.parseFloat(t.style.left), c = o + a - r, l = a * Y;
|
|
2135
|
+
if (!(Number.isFinite(c) && c >= 0 && c <= l && n >= s && n <= s + i)) {
|
|
2136
|
+
this.clearHoverShadow();
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
let u = (1 - Math.min(1, c / l)) * X;
|
|
2140
|
+
this.applyHoverPreview(e, u, i > 0 ? Math.max(0, Math.min(1, (n - s) / i)) : .5);
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
let i = this.spineX, a = n >= i, o = this.isLTR === a, s = o ? A.Forward : A.Backward, c = this.getNextAvailableLeaf(s);
|
|
2076
2144
|
if (!c) {
|
|
2077
2145
|
this.clearHoverShadow();
|
|
2078
2146
|
return;
|