@frybynite/image-cloud 0.5.0 → 0.5.2
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/ImageCloud.d.ts +99 -0
- package/dist/ImageCloud.d.ts.map +1 -0
- package/dist/config/adapter.d.ts +50 -0
- package/dist/config/adapter.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +118 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/types.d.ts +599 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/engines/AnimationEngine.d.ts +82 -0
- package/dist/engines/AnimationEngine.d.ts.map +1 -0
- package/dist/engines/EntryAnimationEngine.d.ts +161 -0
- package/dist/engines/EntryAnimationEngine.d.ts.map +1 -0
- package/dist/engines/LayoutEngine.d.ts +68 -0
- package/dist/engines/LayoutEngine.d.ts.map +1 -0
- package/dist/engines/PathAnimator.d.ts +50 -0
- package/dist/engines/PathAnimator.d.ts.map +1 -0
- package/dist/engines/SwipeEngine.d.ts +53 -0
- package/dist/engines/SwipeEngine.d.ts.map +1 -0
- package/dist/engines/ZoomEngine.d.ts +139 -0
- package/dist/engines/ZoomEngine.d.ts.map +1 -0
- package/dist/image-cloud-auto-init.d.ts +14 -0
- package/dist/image-cloud-auto-init.d.ts.map +1 -0
- package/dist/image-cloud-auto-init.js +215 -244
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +235 -264
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +23 -1637
- package/dist/index.d.ts.map +1 -0
- package/dist/layouts/ClusterPlacementLayout.d.ts +40 -0
- package/dist/layouts/ClusterPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/GridPlacementLayout.d.ts +27 -0
- package/dist/layouts/GridPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/RadialPlacementLayout.d.ts +33 -0
- package/dist/layouts/RadialPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/RandomPlacementLayout.d.ts +26 -0
- package/dist/layouts/RandomPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/SpiralPlacementLayout.d.ts +43 -0
- package/dist/layouts/SpiralPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/WavePlacementLayout.d.ts +48 -0
- package/dist/layouts/WavePlacementLayout.d.ts.map +1 -0
- package/dist/loaders/CompositeLoader.d.ts +37 -0
- package/dist/loaders/CompositeLoader.d.ts.map +1 -0
- package/dist/loaders/GoogleDriveLoader.d.ts +90 -0
- package/dist/loaders/GoogleDriveLoader.d.ts.map +1 -0
- package/dist/loaders/ImageFilter.d.ts +26 -0
- package/dist/loaders/ImageFilter.d.ts.map +1 -0
- package/dist/loaders/StaticImageLoader.d.ts +85 -0
- package/dist/loaders/StaticImageLoader.d.ts.map +1 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react.d.ts +1 -1637
- package/dist/react.js +326 -355
- package/dist/react.js.map +1 -1
- package/dist/styles/functionalStyles.d.ts +11 -0
- package/dist/styles/functionalStyles.d.ts.map +1 -0
- package/dist/utils/styleUtils.d.ts +54 -0
- package/dist/utils/styleUtils.d.ts.map +1 -0
- package/dist/vue/index.d.ts +18 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue.d.ts +1 -1637
- package/dist/vue.js +235 -264
- package/dist/vue.js.map +1 -1
- package/dist/web-component/index.d.ts +15 -0
- package/dist/web-component/index.d.ts.map +1 -0
- package/dist/web-component.d.ts +1 -1637
- package/dist/web-component.js +201 -230
- package/dist/web-component.js.map +1 -1
- package/package.json +11 -5
package/dist/web-component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const mt = Object.freeze({
|
|
2
2
|
none: "none",
|
|
3
3
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
@@ -80,12 +80,12 @@ const ft = Object.freeze({
|
|
|
80
80
|
}), Rt = Object.freeze({
|
|
81
81
|
sizing: Ut,
|
|
82
82
|
rotation: Pt
|
|
83
|
-
}),
|
|
83
|
+
}), Mt = Object.freeze({
|
|
84
84
|
validateUrls: !0,
|
|
85
85
|
validationTimeout: 5e3,
|
|
86
86
|
validationMethod: "head",
|
|
87
87
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
88
|
-
}),
|
|
88
|
+
}), Lt = Object.freeze({
|
|
89
89
|
enabled: !1,
|
|
90
90
|
centers: !1,
|
|
91
91
|
loaders: !1
|
|
@@ -94,8 +94,8 @@ const ft = Object.freeze({
|
|
|
94
94
|
loaders: [],
|
|
95
95
|
// Shared loader settings and debug config
|
|
96
96
|
config: Object.freeze({
|
|
97
|
-
loaders:
|
|
98
|
-
debug:
|
|
97
|
+
loaders: Mt,
|
|
98
|
+
debug: Lt
|
|
99
99
|
}),
|
|
100
100
|
// Image sizing and rotation configuration
|
|
101
101
|
image: Rt,
|
|
@@ -227,7 +227,7 @@ function Z(n, t) {
|
|
|
227
227
|
const e = { ...n };
|
|
228
228
|
return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Nt(n, t) {
|
|
231
231
|
if (!t) return { ...n };
|
|
232
232
|
const e = Z(n.default, t.default), i = Z(
|
|
233
233
|
Z(e, n.hover),
|
|
@@ -242,7 +242,7 @@ function Ht(n, t) {
|
|
|
242
242
|
focused: o
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function Ht(n, t) {
|
|
246
246
|
if (!t) return { ...n };
|
|
247
247
|
const e = { ...n };
|
|
248
248
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
@@ -301,18 +301,18 @@ function Wt(n = {}) {
|
|
|
301
301
|
});
|
|
302
302
|
const r = {
|
|
303
303
|
loaders: {
|
|
304
|
-
...
|
|
304
|
+
...Mt,
|
|
305
305
|
...n.config?.loaders ?? {}
|
|
306
306
|
}
|
|
307
307
|
}, a = {
|
|
308
308
|
loaders: o,
|
|
309
309
|
config: r,
|
|
310
|
-
image:
|
|
310
|
+
image: Ht(Rt, i),
|
|
311
311
|
layout: { ...y.layout },
|
|
312
312
|
animation: { ...y.animation },
|
|
313
313
|
interaction: { ...y.interaction },
|
|
314
314
|
rendering: { ...y.rendering },
|
|
315
|
-
styling:
|
|
315
|
+
styling: Nt(Ct, n.styling)
|
|
316
316
|
};
|
|
317
317
|
return n.layout && (a.layout = {
|
|
318
318
|
...y.layout,
|
|
@@ -375,7 +375,7 @@ function Wt(n = {}) {
|
|
|
375
375
|
...y.rendering.performance,
|
|
376
376
|
...n.rendering.performance
|
|
377
377
|
})), a.config.debug = {
|
|
378
|
-
...
|
|
378
|
+
...Lt,
|
|
379
379
|
...n.config?.debug ?? {}
|
|
380
380
|
}, a;
|
|
381
381
|
}
|
|
@@ -549,22 +549,22 @@ function V(n, t, e) {
|
|
|
549
549
|
}
|
|
550
550
|
function Bt(n, t, e, i) {
|
|
551
551
|
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c = Jt(s, r);
|
|
552
|
-
let u = 0, l = 0, d = 1,
|
|
552
|
+
let u = 0, l = 0, d = 1, m = o, b = !1;
|
|
553
553
|
for (let g = 0; g < c.length; g++)
|
|
554
554
|
if (n <= c[g].time) {
|
|
555
|
-
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time,
|
|
555
|
+
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time, m = c[g].overshoot, b = c[g].isOvershoot;
|
|
556
556
|
break;
|
|
557
557
|
}
|
|
558
558
|
const p = (n - l) / (d - l);
|
|
559
559
|
if (b)
|
|
560
|
-
u = 1 +
|
|
560
|
+
u = 1 + m * ot(p);
|
|
561
561
|
else if (l === 0)
|
|
562
562
|
u = ot(p);
|
|
563
563
|
else {
|
|
564
|
-
const
|
|
564
|
+
const f = 1 + (c.find(
|
|
565
565
|
(E, v) => E.time > l && v > 0 && c[v - 1].isOvershoot
|
|
566
|
-
)?.overshoot ||
|
|
567
|
-
u = V(
|
|
566
|
+
)?.overshoot || m);
|
|
567
|
+
u = V(f, 1, ot(p));
|
|
568
568
|
}
|
|
569
569
|
return {
|
|
570
570
|
x: t.x + a * u,
|
|
@@ -585,7 +585,7 @@ function Vt(n, t, e, i) {
|
|
|
585
585
|
const { stiffness: o, damping: s, mass: r, oscillations: a } = i, h = e.x - t.x, c = e.y - t.y, u = Math.sqrt(o / r), l = s / (2 * Math.sqrt(o * r));
|
|
586
586
|
let d;
|
|
587
587
|
if (l < 1) {
|
|
588
|
-
const
|
|
588
|
+
const m = u * Math.sqrt(1 - l * l), b = Math.exp(-l * u * n * 3), p = Math.cos(m * n * a * Math.PI);
|
|
589
589
|
d = 1 - b * p;
|
|
590
590
|
} else
|
|
591
591
|
d = 1 - Math.exp(-u * n * 3);
|
|
@@ -595,10 +595,10 @@ function Vt(n, t, e, i) {
|
|
|
595
595
|
};
|
|
596
596
|
}
|
|
597
597
|
function Kt(n, t, e, i) {
|
|
598
|
-
const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: h } = i, c = e.x - t.x, u = e.y - t.y, l = Math.sqrt(c * c + u * u), d = l > 0 ? -u / l : 0,
|
|
598
|
+
const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: h } = i, c = e.x - t.x, u = e.y - t.y, l = Math.sqrt(c * c + u * u), d = l > 0 ? -u / l : 0, m = l > 0 ? c / l : 1, b = s * Math.PI * 2 * n + h, p = r ? Math.pow(1 - n, a) : 1, g = o * Math.sin(b) * p, f = Zt(n);
|
|
599
599
|
return {
|
|
600
|
-
x: V(t.x, e.x,
|
|
601
|
-
y: V(t.y, e.y,
|
|
600
|
+
x: V(t.x, e.x, f) + g * d,
|
|
601
|
+
y: V(t.y, e.y, f) + g * m
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
604
|
function ot(n) {
|
|
@@ -618,14 +618,14 @@ function te(n, t, e) {
|
|
|
618
618
|
const a = 0.5, c = 0.5 / (o * 2);
|
|
619
619
|
let u = 0.5;
|
|
620
620
|
for (let d = 0; d < o; d++) {
|
|
621
|
-
const
|
|
622
|
-
u += c, s.push({ time: u, scale:
|
|
621
|
+
const m = 1 - (r - 1) * a;
|
|
622
|
+
u += c, s.push({ time: u, scale: m }), r = 1 + (r - 1) * a * a, u += c, d < o - 1 && s.push({ time: u, scale: r });
|
|
623
623
|
}
|
|
624
624
|
s.push({ time: 1, scale: 1 });
|
|
625
625
|
let l = 1;
|
|
626
626
|
for (let d = 0; d < s.length; d++)
|
|
627
627
|
if (n <= s[d].time) {
|
|
628
|
-
const
|
|
628
|
+
const m = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (n - m) / (s[d].time - m), g = ot(p);
|
|
629
629
|
l = b + (s[d].scale - b) * g;
|
|
630
630
|
break;
|
|
631
631
|
}
|
|
@@ -645,16 +645,16 @@ function ee(n) {
|
|
|
645
645
|
onComplete: u,
|
|
646
646
|
rotationConfig: l,
|
|
647
647
|
startRotation: d,
|
|
648
|
-
scaleConfig:
|
|
648
|
+
scaleConfig: m,
|
|
649
649
|
startScale: b
|
|
650
|
-
} = n, p = o.type, g = d !== void 0 && d !== h,
|
|
650
|
+
} = n, p = o.type, g = d !== void 0 && d !== h, f = l?.mode === "wobble", E = l?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = g || f, w = b !== void 0 && b !== c, S = m?.mode === "pop", x = m?.pop || { overshoot: 1.2, bounces: 1 };
|
|
651
651
|
if ((p === "linear" || p === "arc") && !v && !(w || S)) {
|
|
652
652
|
u && u();
|
|
653
653
|
return;
|
|
654
654
|
}
|
|
655
|
-
const
|
|
655
|
+
const L = performance.now(), z = -r / 2, U = -a / 2;
|
|
656
656
|
function P(Y) {
|
|
657
|
-
const
|
|
657
|
+
const H = Y - L, T = Math.min(H / s, 1);
|
|
658
658
|
let O;
|
|
659
659
|
switch (p) {
|
|
660
660
|
case "bounce": {
|
|
@@ -662,7 +662,7 @@ function ee(n) {
|
|
|
662
662
|
o.bouncePreset,
|
|
663
663
|
o.bounce
|
|
664
664
|
);
|
|
665
|
-
O = Bt(
|
|
665
|
+
O = Bt(T, e, i, D);
|
|
666
666
|
break;
|
|
667
667
|
}
|
|
668
668
|
case "elastic": {
|
|
@@ -670,7 +670,7 @@ function ee(n) {
|
|
|
670
670
|
o.elasticPreset,
|
|
671
671
|
o.elastic
|
|
672
672
|
);
|
|
673
|
-
O = Vt(
|
|
673
|
+
O = Vt(T, e, i, D);
|
|
674
674
|
break;
|
|
675
675
|
}
|
|
676
676
|
case "wave": {
|
|
@@ -678,20 +678,20 @@ function ee(n) {
|
|
|
678
678
|
o.wavePreset,
|
|
679
679
|
o.wave
|
|
680
680
|
);
|
|
681
|
-
O = Kt(
|
|
681
|
+
O = Kt(T, e, i, D);
|
|
682
682
|
break;
|
|
683
683
|
}
|
|
684
684
|
default:
|
|
685
685
|
O = {
|
|
686
|
-
x: V(e.x, i.x,
|
|
687
|
-
y: V(e.y, i.y,
|
|
686
|
+
x: V(e.x, i.x, T),
|
|
687
|
+
y: V(e.y, i.y, T)
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
const k = O.x - i.x,
|
|
690
|
+
const k = O.x - i.x, N = O.y - i.y;
|
|
691
691
|
let R;
|
|
692
|
-
|
|
692
|
+
f ? R = Qt(T, h, E) : g ? R = V(d, h, T) : R = h;
|
|
693
693
|
let C;
|
|
694
|
-
S ? C = te(
|
|
694
|
+
S ? C = te(T, c, x) : w ? C = V(b, c, T) : C = c, t.style.transform = `translate(${z}px, ${U}px) translate(${k}px, ${N}px) rotate(${R}deg) scale(${C})`, T < 1 ? requestAnimationFrame(P) : (t.style.transform = `translate(${z}px, ${U}px) rotate(${h}deg) scale(${c})`, u && u());
|
|
695
695
|
}
|
|
696
696
|
requestAnimationFrame(P);
|
|
697
697
|
}
|
|
@@ -753,8 +753,8 @@ class oe {
|
|
|
753
753
|
*/
|
|
754
754
|
calculateNearestEdge(t, e, i, o) {
|
|
755
755
|
const s = t.x, r = t.y, a = s, h = i.width - s, c = r, u = i.height - r, l = Math.min(a, h, c, u);
|
|
756
|
-
let d = t.x,
|
|
757
|
-
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ?
|
|
756
|
+
let d = t.x, m = t.y;
|
|
757
|
+
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ? m = -(e.height + o) : m = i.height + o, { x: d, y: m };
|
|
758
758
|
}
|
|
759
759
|
/**
|
|
760
760
|
* Calculate start position from a specific edge
|
|
@@ -812,8 +812,8 @@ class oe {
|
|
|
812
812
|
h = typeof c == "number" ? c : 500;
|
|
813
813
|
let u;
|
|
814
814
|
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
815
|
-
const l = i.width / 2, d = i.height / 2,
|
|
816
|
-
return { x:
|
|
815
|
+
const l = i.width / 2, d = i.height / 2, m = l + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
816
|
+
return { x: m, y: b };
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* Get animation parameters for an image
|
|
@@ -833,7 +833,7 @@ class oe {
|
|
|
833
833
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
834
834
|
*/
|
|
835
835
|
buildStartTransform(t, e, i, o, s, r, a, h) {
|
|
836
|
-
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o,
|
|
836
|
+
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o, m = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${m}px, ${b}px)` : "translate(-50%, -50%)";
|
|
837
837
|
return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${l}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${l}deg) scale(${d})`;
|
|
838
838
|
}
|
|
839
839
|
/**
|
|
@@ -1062,12 +1062,12 @@ class se {
|
|
|
1062
1062
|
* @returns Array of layout objects with position, rotation, scale
|
|
1063
1063
|
*/
|
|
1064
1064
|
generate(t, e, i = {}) {
|
|
1065
|
-
const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1,
|
|
1065
|
+
const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, E = s - a - g, v = r - a - f, w = a + g, S = a + f;
|
|
1066
1066
|
for (let x = 0; x < t; x++) {
|
|
1067
|
-
const
|
|
1067
|
+
const A = this.random(w, E), L = this.random(S, v), z = c === "random" ? this.random(u, l) : 0, U = b ? this.random(d, m) : 1, P = h * U, Y = {
|
|
1068
1068
|
id: x,
|
|
1069
|
-
x:
|
|
1070
|
-
y:
|
|
1069
|
+
x: A,
|
|
1070
|
+
y: L,
|
|
1071
1071
|
rotation: z,
|
|
1072
1072
|
scale: U,
|
|
1073
1073
|
baseSize: P
|
|
@@ -1098,13 +1098,13 @@ class ae {
|
|
|
1098
1098
|
* @returns Array of layout objects with position, rotation, scale
|
|
1099
1099
|
*/
|
|
1100
1100
|
generate(t, e, i = {}) {
|
|
1101
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1,
|
|
1101
|
+
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = i.fixedHeight ?? a, g = s / 2, f = r / 2, E = Math.ceil(Math.sqrt(t));
|
|
1102
1102
|
if (t > 0) {
|
|
1103
|
-
const S =
|
|
1103
|
+
const S = m ? this.random(l, d) : 1, x = p * S;
|
|
1104
1104
|
o.push({
|
|
1105
1105
|
id: 0,
|
|
1106
1106
|
x: g,
|
|
1107
|
-
y:
|
|
1107
|
+
y: f,
|
|
1108
1108
|
rotation: h === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1109
1109
|
// Less rotation for center
|
|
1110
1110
|
scale: S,
|
|
@@ -1115,24 +1115,24 @@ class ae {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
let v = 1, w = 1;
|
|
1117
1117
|
for (; v < t; ) {
|
|
1118
|
-
const S = w / E, x = b > 0 ? 1 - S * b * 0.5 : 1,
|
|
1118
|
+
const S = w / E, x = b > 0 ? 1 - S * b * 0.5 : 1, A = w * (p * 0.8), L = A * 1.5, z = Math.PI * (3 * (L + A) - Math.sqrt((3 * L + A) * (L + 3 * A))), U = this.estimateWidth(p), P = Math.floor(z / (U * 0.7));
|
|
1119
1119
|
if (P === 0) {
|
|
1120
1120
|
w++;
|
|
1121
1121
|
continue;
|
|
1122
1122
|
}
|
|
1123
|
-
const Y = 2 * Math.PI / P,
|
|
1124
|
-
for (let
|
|
1125
|
-
const O =
|
|
1126
|
-
let C = g + Math.cos(O) *
|
|
1127
|
-
const $ = this.config.spacing.padding ?? 50, _ = R * 1.5 / 2,
|
|
1128
|
-
C - _ < $ ? C = $ + _ : C + _ > s - $ && (C = s - $ - _), D -
|
|
1123
|
+
const Y = 2 * Math.PI / P, H = w * (20 * Math.PI / 180);
|
|
1124
|
+
for (let T = 0; T < P && v < t; T++) {
|
|
1125
|
+
const O = T * Y + H, k = m ? this.random(l, d) : 1, N = x * k, R = p * N;
|
|
1126
|
+
let C = g + Math.cos(O) * L, D = f + Math.sin(O) * A;
|
|
1127
|
+
const $ = this.config.spacing.padding ?? 50, _ = R * 1.5 / 2, M = R / 2;
|
|
1128
|
+
C - _ < $ ? C = $ + _ : C + _ > s - $ && (C = s - $ - _), D - M < $ ? D = $ + M : D + M > r - $ && (D = r - $ - M);
|
|
1129
1129
|
const W = h === "random" ? this.random(c, u) : 0;
|
|
1130
1130
|
o.push({
|
|
1131
1131
|
id: v,
|
|
1132
1132
|
x: C,
|
|
1133
1133
|
y: D,
|
|
1134
1134
|
rotation: W,
|
|
1135
|
-
scale:
|
|
1135
|
+
scale: N,
|
|
1136
1136
|
baseSize: R,
|
|
1137
1137
|
zIndex: Math.max(1, 100 - w)
|
|
1138
1138
|
// Outer rings have lower z-index
|
|
@@ -1171,7 +1171,7 @@ const re = {
|
|
|
1171
1171
|
alignment: "center",
|
|
1172
1172
|
gap: 10,
|
|
1173
1173
|
overflowOffset: 0.25
|
|
1174
|
-
},
|
|
1174
|
+
}, At = [
|
|
1175
1175
|
{ x: 1, y: 1 },
|
|
1176
1176
|
// bottom-right
|
|
1177
1177
|
{ x: -1, y: -1 },
|
|
@@ -1201,50 +1201,50 @@ class ce {
|
|
|
1201
1201
|
* @returns Array of layout objects with position, rotation, scale
|
|
1202
1202
|
*/
|
|
1203
1203
|
generate(t, e, i = {}) {
|
|
1204
|
-
const o = [], { width: s, height: r } = e, a = { ...re, ...this.config.grid }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1,
|
|
1204
|
+
const o = [], { width: s, height: r } = e, a = { ...re, ...this.config.grid }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || d !== 1, b = s - 2 * h, p = r - 2 * h, { columns: g, rows: f } = this.calculateGridDimensions(
|
|
1205
1205
|
t,
|
|
1206
1206
|
b,
|
|
1207
1207
|
p,
|
|
1208
1208
|
c,
|
|
1209
1209
|
a
|
|
1210
|
-
), E = a.stagger === "row", v = a.stagger === "column", w = E ? g + 0.5 : g, S = v ?
|
|
1210
|
+
), E = a.stagger === "row", v = a.stagger === "column", w = E ? g + 0.5 : g, S = v ? f + 0.5 : f, x = (b - a.gap * (g - 1)) / w, A = (p - a.gap * (f - 1)) / S, L = E ? x / 2 : 0, z = v ? A / 2 : 0, U = 1 + a.overlap, P = Math.min(x, A) * U, Y = i.fixedHeight ? Math.min(i.fixedHeight, P) : P, H = g * x + (g - 1) * a.gap + L, T = f * A + (f - 1) * a.gap + z, O = h + (b - H) / 2, k = h + (p - T) / 2, N = g * f, R = a.columns !== "auto" && a.rows !== "auto", C = R && t > N;
|
|
1211
1211
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1212
1212
|
gridConfigColumns: a.columns,
|
|
1213
1213
|
gridConfigRows: a.rows,
|
|
1214
1214
|
columns: g,
|
|
1215
|
-
rows:
|
|
1216
|
-
cellCount:
|
|
1215
|
+
rows: f,
|
|
1216
|
+
cellCount: N,
|
|
1217
1217
|
hasFixedGrid: R,
|
|
1218
1218
|
imageCount: t,
|
|
1219
1219
|
isOverflowMode: C
|
|
1220
1220
|
});
|
|
1221
|
-
const D = C ? new Array(
|
|
1221
|
+
const D = C ? new Array(N).fill(0) : [], $ = Math.min(x, A) * a.overflowOffset;
|
|
1222
1222
|
for (let F = 0; F < t; F++) {
|
|
1223
|
-
let _,
|
|
1224
|
-
if (C && F >=
|
|
1225
|
-
const q = F -
|
|
1226
|
-
W = Math.floor(q /
|
|
1223
|
+
let _, M, W = 0;
|
|
1224
|
+
if (C && F >= N) {
|
|
1225
|
+
const q = F - N, j = q % N;
|
|
1226
|
+
W = Math.floor(q / N) + 1, D[j]++, a.fillDirection === "row" ? (_ = j % g, M = Math.floor(j / g)) : (M = j % f, _ = Math.floor(j / f));
|
|
1227
1227
|
} else
|
|
1228
|
-
a.fillDirection === "row" ? (_ = F % g,
|
|
1229
|
-
let G = O + _ * (x + a.gap) + x / 2, X = k +
|
|
1230
|
-
if (a.stagger === "row" &&
|
|
1231
|
-
const q = (W - 1) %
|
|
1228
|
+
a.fillDirection === "row" ? (_ = F % g, M = Math.floor(F / g)) : (M = F % f, _ = Math.floor(F / f));
|
|
1229
|
+
let G = O + _ * (x + a.gap) + x / 2, X = k + M * (A + a.gap) + A / 2;
|
|
1230
|
+
if (a.stagger === "row" && M % 2 === 1 ? G += x / 2 : a.stagger === "column" && _ % 2 === 1 && (X += A / 2), W > 0) {
|
|
1231
|
+
const q = (W - 1) % At.length, j = At[q];
|
|
1232
1232
|
G += j.x * $, X += j.y * $;
|
|
1233
1233
|
}
|
|
1234
1234
|
if (a.jitter > 0) {
|
|
1235
|
-
const q = x / 2 * a.jitter, j =
|
|
1235
|
+
const q = x / 2 * a.jitter, j = A / 2 * a.jitter;
|
|
1236
1236
|
G += this.random(-q, q), X += this.random(-j, j);
|
|
1237
1237
|
}
|
|
1238
1238
|
let B = G, J = X;
|
|
1239
1239
|
if (!C && a.fillDirection === "row") {
|
|
1240
1240
|
const q = t % g || g;
|
|
1241
|
-
if (
|
|
1241
|
+
if (M === Math.floor((t - 1) / g) && q < g) {
|
|
1242
1242
|
const xt = q * x + (q - 1) * a.gap;
|
|
1243
1243
|
let gt = 0;
|
|
1244
|
-
a.alignment === "center" ? gt = (
|
|
1244
|
+
a.alignment === "center" ? gt = (H - xt) / 2 : a.alignment === "end" && (gt = H - xt), B += gt;
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
|
-
const rt =
|
|
1247
|
+
const rt = m ? this.random(l, d) : 1, K = Y * rt, it = K * 1.5 / 2, nt = K / 2, lt = h + it, ht = s - h - it, Ot = h + nt, Dt = r - h - nt;
|
|
1248
1248
|
B = Math.max(lt, Math.min(B, ht)), J = Math.max(Ot, Math.min(J, Dt));
|
|
1249
1249
|
let dt = 0;
|
|
1250
1250
|
if (u === "random") {
|
|
@@ -1308,35 +1308,35 @@ class de {
|
|
|
1308
1308
|
* @returns Array of layout objects with position, rotation, scale
|
|
1309
1309
|
*/
|
|
1310
1310
|
generate(t, e, i = {}) {
|
|
1311
|
-
const o = [], { width: s, height: r } = e, a = { ...he, ...this.config.spiral }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15,
|
|
1312
|
-
|
|
1311
|
+
const o = [], { width: s, height: r } = e, a = { ...he, ...this.config.spiral }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? a.scaleDecay, f = s / 2, E = r / 2, v = Math.min(
|
|
1312
|
+
f - h - c / 2,
|
|
1313
1313
|
E - h - c / 2
|
|
1314
1314
|
), w = a.direction === "clockwise" ? -1 : 1;
|
|
1315
1315
|
for (let S = 0; S < t; S++) {
|
|
1316
|
-
let x,
|
|
1316
|
+
let x, A;
|
|
1317
1317
|
if (a.spiralType === "golden")
|
|
1318
|
-
x = S * le * w + a.startAngle,
|
|
1318
|
+
x = S * le * w + a.startAngle, A = this.calculateGoldenRadius(S, t, v, a.tightness);
|
|
1319
1319
|
else if (a.spiralType === "archimedean") {
|
|
1320
1320
|
const G = S * 0.5 * a.tightness;
|
|
1321
|
-
x = G * w + a.startAngle,
|
|
1321
|
+
x = G * w + a.startAngle, A = this.calculateArchimedeanRadius(G, t, v, a.tightness);
|
|
1322
1322
|
} else {
|
|
1323
1323
|
const G = S * 0.3 * a.tightness;
|
|
1324
|
-
x = G * w + a.startAngle,
|
|
1324
|
+
x = G * w + a.startAngle, A = this.calculateLogarithmicRadius(G, t, v, a.tightness);
|
|
1325
1325
|
}
|
|
1326
|
-
const
|
|
1327
|
-
let
|
|
1326
|
+
const L = f + Math.cos(x) * A, z = E + Math.sin(x) * A, U = A / v, P = g > 0 ? 1 - U * g * 0.5 : 1, Y = p ? this.random(m, b) : 1, H = P * Y, T = c * H, k = T * 1.5 / 2, N = T / 2, R = h + k, C = s - h - k, D = h + N, $ = r - h - N, F = Math.max(R, Math.min(L, C)), _ = Math.max(D, Math.min(z, $));
|
|
1327
|
+
let M = 0;
|
|
1328
1328
|
if (u === "random") {
|
|
1329
1329
|
const G = x * 180 / Math.PI % 360, X = this.random(l, d);
|
|
1330
|
-
|
|
1331
|
-
} else u === "tangent" && (
|
|
1330
|
+
M = a.spiralType === "golden" ? X : G * 0.1 + X * 0.9;
|
|
1331
|
+
} else u === "tangent" && (M = this.calculateSpiralTangent(x, A, a));
|
|
1332
1332
|
const W = t - S;
|
|
1333
1333
|
o.push({
|
|
1334
1334
|
id: S,
|
|
1335
1335
|
x: F,
|
|
1336
1336
|
y: _,
|
|
1337
|
-
rotation:
|
|
1338
|
-
scale:
|
|
1339
|
-
baseSize:
|
|
1337
|
+
rotation: M,
|
|
1338
|
+
scale: H,
|
|
1339
|
+
baseSize: T,
|
|
1340
1340
|
zIndex: W
|
|
1341
1341
|
});
|
|
1342
1342
|
}
|
|
@@ -1410,13 +1410,13 @@ class ge {
|
|
|
1410
1410
|
* @returns Array of layout objects with position, rotation, scale
|
|
1411
1411
|
*/
|
|
1412
1412
|
generate(t, e, i = {}) {
|
|
1413
|
-
const o = [], { width: s, height: r } = e, a = { ...ue, ...this.config.cluster }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15,
|
|
1413
|
+
const o = [], { width: s, height: r } = e, a = { ...ue, ...this.config.cluster }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1414
1414
|
t,
|
|
1415
1415
|
a.clusterCount,
|
|
1416
1416
|
s,
|
|
1417
1417
|
r,
|
|
1418
1418
|
a.clusterSpacing
|
|
1419
|
-
),
|
|
1419
|
+
), f = this.generateClusterCenters(
|
|
1420
1420
|
g,
|
|
1421
1421
|
s,
|
|
1422
1422
|
r,
|
|
@@ -1427,29 +1427,29 @@ class ge {
|
|
|
1427
1427
|
E[w % g]++;
|
|
1428
1428
|
let v = 0;
|
|
1429
1429
|
for (let w = 0; w < g; w++) {
|
|
1430
|
-
const S =
|
|
1431
|
-
for (let
|
|
1432
|
-
let
|
|
1430
|
+
const S = f[w], x = E[w];
|
|
1431
|
+
for (let A = 0; A < x; A++) {
|
|
1432
|
+
let L, z;
|
|
1433
1433
|
if (a.distribution === "gaussian")
|
|
1434
|
-
|
|
1434
|
+
L = this.gaussianRandom() * S.spread, z = this.gaussianRandom() * S.spread;
|
|
1435
1435
|
else {
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1436
|
+
const M = this.random(0, Math.PI * 2), W = this.random(0, S.spread);
|
|
1437
|
+
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1438
1438
|
}
|
|
1439
1439
|
const U = 1 + a.overlap * 0.5, P = 1 + a.overlap * 0.3;
|
|
1440
|
-
|
|
1441
|
-
const Y = p ? this.random(
|
|
1442
|
-
let O = S.x +
|
|
1443
|
-
const R =
|
|
1440
|
+
L /= U, z /= U;
|
|
1441
|
+
const Y = p ? this.random(m, b) : 1, H = P * Y, T = c * H;
|
|
1442
|
+
let O = S.x + L, k = S.y + z;
|
|
1443
|
+
const R = T * 1.5 / 2, C = T / 2;
|
|
1444
1444
|
O = Math.max(h + R, Math.min(O, s - h - R)), k = Math.max(h + C, Math.min(k, r - h - C));
|
|
1445
|
-
const D = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(
|
|
1445
|
+
const D = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(L * L + z * z) / S.spread, _ = Math.round((1 - F) * 50) + 1;
|
|
1446
1446
|
o.push({
|
|
1447
1447
|
id: v,
|
|
1448
1448
|
x: O,
|
|
1449
1449
|
y: k,
|
|
1450
1450
|
rotation: D,
|
|
1451
|
-
scale:
|
|
1452
|
-
baseSize:
|
|
1451
|
+
scale: H,
|
|
1452
|
+
baseSize: T,
|
|
1453
1453
|
zIndex: _
|
|
1454
1454
|
}), v++;
|
|
1455
1455
|
}
|
|
@@ -1473,22 +1473,22 @@ class ge {
|
|
|
1473
1473
|
generateClusterCenters(t, e, i, o, s) {
|
|
1474
1474
|
const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, l = i - o - s.clusterSpread;
|
|
1475
1475
|
for (let d = 0; d < t; d++) {
|
|
1476
|
-
let
|
|
1476
|
+
let m = null, b = -1;
|
|
1477
1477
|
for (let p = 0; p < 100; p++) {
|
|
1478
1478
|
const g = {
|
|
1479
1479
|
x: this.random(h, c),
|
|
1480
1480
|
y: this.random(u, l),
|
|
1481
1481
|
spread: this.calculateClusterSpread(s)
|
|
1482
1482
|
};
|
|
1483
|
-
let
|
|
1483
|
+
let f = 1 / 0;
|
|
1484
1484
|
for (const E of r) {
|
|
1485
1485
|
const v = g.x - E.x, w = g.y - E.y, S = Math.sqrt(v * v + w * w);
|
|
1486
|
-
|
|
1486
|
+
f = Math.min(f, S);
|
|
1487
1487
|
}
|
|
1488
|
-
if ((r.length === 0 ||
|
|
1488
|
+
if ((r.length === 0 || f > b) && (m = g, b = f), f >= s.clusterSpacing)
|
|
1489
1489
|
break;
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
m && r.push(m);
|
|
1492
1492
|
}
|
|
1493
1493
|
return r;
|
|
1494
1494
|
}
|
|
@@ -1516,7 +1516,7 @@ class ge {
|
|
|
1516
1516
|
return Math.random() * (e - t) + t;
|
|
1517
1517
|
}
|
|
1518
1518
|
}
|
|
1519
|
-
class
|
|
1519
|
+
class me {
|
|
1520
1520
|
constructor(t, e = {}) {
|
|
1521
1521
|
this.config = t, this.imageConfig = e;
|
|
1522
1522
|
}
|
|
@@ -1528,17 +1528,17 @@ class fe {
|
|
|
1528
1528
|
* @returns Array of layout objects with position, rotation, scale
|
|
1529
1529
|
*/
|
|
1530
1530
|
generate(t, e, i = {}) {
|
|
1531
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1,
|
|
1531
|
+
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || m !== 1, p = i.fixedHeight ?? a, g = {
|
|
1532
1532
|
...$t,
|
|
1533
1533
|
...this.config.wave
|
|
1534
|
-
}, { rows:
|
|
1534
|
+
}, { rows: f, amplitude: E, frequency: v, phaseShift: w, synchronization: S } = g, x = Math.ceil(t / f), z = p * 1.5 / 2, U = h + z, P = s - h - z, Y = P - U, H = x > 1 ? Y / (x - 1) : 0, T = h + E + p / 2, O = r - h - E - p / 2, k = O - T, N = f > 1 ? k / (f - 1) : 0;
|
|
1535
1535
|
let R = 0;
|
|
1536
|
-
for (let C = 0; C <
|
|
1537
|
-
const D =
|
|
1536
|
+
for (let C = 0; C < f && R < t; C++) {
|
|
1537
|
+
const D = f === 1 ? (T + O) / 2 : T + C * N;
|
|
1538
1538
|
let $ = 0;
|
|
1539
1539
|
S === "offset" ? $ = C * w : S === "alternating" && ($ = C * Math.PI);
|
|
1540
1540
|
for (let F = 0; F < x && R < t; F++) {
|
|
1541
|
-
const _ = x === 1 ? (U + P) / 2 : U + F *
|
|
1541
|
+
const _ = x === 1 ? (U + P) / 2 : U + F * H, M = this.calculateWaveY(_, s, E, v, $), W = _, G = D + M, X = b ? this.random(d, m) : 1, B = p * X;
|
|
1542
1542
|
let J = 0;
|
|
1543
1543
|
c === "tangent" ? J = this.calculateRotation(_, s, E, v, $) : c === "random" && (J = this.random(u, l));
|
|
1544
1544
|
const K = B * 1.5 / 2, ct = B / 2, it = h + K, nt = s - h - K, lt = h + ct, ht = r - h - ct;
|
|
@@ -1593,7 +1593,7 @@ class fe {
|
|
|
1593
1593
|
return Math.random() * (e - t) + t;
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
|
-
class
|
|
1596
|
+
class fe {
|
|
1597
1597
|
constructor(t) {
|
|
1598
1598
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1599
1599
|
}
|
|
@@ -1612,7 +1612,7 @@ class me {
|
|
|
1612
1612
|
case "cluster":
|
|
1613
1613
|
return new ge(this.config, this.imageConfig);
|
|
1614
1614
|
case "wave":
|
|
1615
|
-
return new
|
|
1615
|
+
return new me(this.config, this.imageConfig);
|
|
1616
1616
|
default:
|
|
1617
1617
|
return new se(this.config, this.imageConfig);
|
|
1618
1618
|
}
|
|
@@ -1697,12 +1697,12 @@ class me {
|
|
|
1697
1697
|
if (r !== void 0)
|
|
1698
1698
|
return { height: r };
|
|
1699
1699
|
const a = s?.minSize ?? 50, h = s?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: l, height: d } = t, p = l * d * c / e;
|
|
1700
|
-
let
|
|
1701
|
-
|
|
1702
|
-
let E = this.clamp(
|
|
1703
|
-
if (E === a &&
|
|
1700
|
+
let f = Math.sqrt(p / 1.4);
|
|
1701
|
+
f *= u, f = Math.min(f, i);
|
|
1702
|
+
let E = this.clamp(f, a, h);
|
|
1703
|
+
if (E === a && f < a) {
|
|
1704
1704
|
const v = Math.max(a * 0.05, 20);
|
|
1705
|
-
E = Math.max(v,
|
|
1705
|
+
E = Math.max(v, f);
|
|
1706
1706
|
}
|
|
1707
1707
|
return { height: E };
|
|
1708
1708
|
}
|
|
@@ -1715,10 +1715,10 @@ class me {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1717
1717
|
function pe(n) {
|
|
1718
|
-
return n in
|
|
1718
|
+
return n in mt;
|
|
1719
1719
|
}
|
|
1720
1720
|
function be(n) {
|
|
1721
|
-
return n ? pe(n) ?
|
|
1721
|
+
return n ? pe(n) ? mt[n] : n : mt.md;
|
|
1722
1722
|
}
|
|
1723
1723
|
function ye(n) {
|
|
1724
1724
|
if (!n) return "";
|
|
@@ -1775,7 +1775,7 @@ function Ft(n, t) {
|
|
|
1775
1775
|
i.trim() && n.classList.remove(i.trim());
|
|
1776
1776
|
});
|
|
1777
1777
|
}
|
|
1778
|
-
const
|
|
1778
|
+
const Tt = {
|
|
1779
1779
|
UNFOCUSING: 999,
|
|
1780
1780
|
FOCUSING: 1e3
|
|
1781
1781
|
};
|
|
@@ -1882,19 +1882,19 @@ class ve {
|
|
|
1882
1882
|
*/
|
|
1883
1883
|
startFocusAnimation(t, e, i, o, s) {
|
|
1884
1884
|
const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1885
|
-
this.applyFocusedStyling(t,
|
|
1885
|
+
this.applyFocusedStyling(t, Tt.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1886
1886
|
const l = o ?? {
|
|
1887
1887
|
x: 0,
|
|
1888
1888
|
y: 0,
|
|
1889
1889
|
rotation: i.rotation,
|
|
1890
1890
|
scale: 1
|
|
1891
1891
|
// No scale - using dimensions
|
|
1892
|
-
}, d = s?.width ?? a,
|
|
1892
|
+
}, d = s?.width ?? a, m = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1893
1893
|
t,
|
|
1894
1894
|
l,
|
|
1895
1895
|
u,
|
|
1896
1896
|
d,
|
|
1897
|
-
|
|
1897
|
+
m,
|
|
1898
1898
|
c.width,
|
|
1899
1899
|
c.height,
|
|
1900
1900
|
b
|
|
@@ -1931,7 +1931,7 @@ class ve {
|
|
|
1931
1931
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1932
1932
|
*/
|
|
1933
1933
|
startUnfocusAnimation(t, e, i, o) {
|
|
1934
|
-
t.style.zIndex = String(
|
|
1934
|
+
t.style.zIndex = String(Tt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1935
1935
|
const s = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, a = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, h = {
|
|
1936
1936
|
x: 0,
|
|
1937
1937
|
y: 0,
|
|
@@ -1947,7 +1947,7 @@ class ve {
|
|
|
1947
1947
|
c,
|
|
1948
1948
|
u,
|
|
1949
1949
|
l
|
|
1950
|
-
),
|
|
1950
|
+
), m = {
|
|
1951
1951
|
id: `unfocus-${Date.now()}`,
|
|
1952
1952
|
element: t,
|
|
1953
1953
|
animation: d,
|
|
@@ -1959,12 +1959,33 @@ class ve {
|
|
|
1959
1959
|
return {
|
|
1960
1960
|
element: t,
|
|
1961
1961
|
originalState: e,
|
|
1962
|
-
animationHandle:
|
|
1962
|
+
animationHandle: m,
|
|
1963
1963
|
direction: "out",
|
|
1964
1964
|
originalWidth: c,
|
|
1965
1965
|
originalHeight: u
|
|
1966
1966
|
};
|
|
1967
1967
|
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Capture the current visual state of an element mid-animation, BEFORE cancelling.
|
|
1970
|
+
*
|
|
1971
|
+
* The computed matrix.e/f include the -50%/-50% centering offset resolved to pixels.
|
|
1972
|
+
* buildDimensionZoomTransform prepends its own translate(-50%,-50%), so passing raw
|
|
1973
|
+
* matrix.e/f doubles the centering and produces the wrong starting position.
|
|
1974
|
+
*
|
|
1975
|
+
* This method extracts the PURE positional offset (pureX = matrix.e + 0.5*midWidth)
|
|
1976
|
+
* and commits width/height/transform to inline styles before the animation is cancelled,
|
|
1977
|
+
* preventing any visual snap.
|
|
1978
|
+
*
|
|
1979
|
+
* Must be called while the animation is still running (offsetWidth reflects animated size).
|
|
1980
|
+
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
1981
|
+
*/
|
|
1982
|
+
captureMidAnimationState(t) {
|
|
1983
|
+
const e = getComputedStyle(t), i = new DOMMatrix(e.transform), o = t.offsetWidth, s = t.offsetHeight, r = i.e + o * 0.5, a = i.f + s * 0.5, h = Math.atan2(i.b, i.a) * (180 / Math.PI);
|
|
1984
|
+
return t.style.width = `${o}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${h}deg)`, t.style.transition = "none", {
|
|
1985
|
+
transform: { x: r, y: a, rotation: h, scale: 1 },
|
|
1986
|
+
dimensions: { width: o, height: s }
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1968
1989
|
/**
|
|
1969
1990
|
* Handle animation completion
|
|
1970
1991
|
*/
|
|
@@ -1990,21 +2011,12 @@ class ve {
|
|
|
1990
2011
|
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
1991
2012
|
return this.unfocusImage();
|
|
1992
2013
|
if (this.incoming?.element === t && this.state === I.FOCUSING) {
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1995
|
-
y: s.y,
|
|
1996
|
-
rotation: s.rotation,
|
|
1997
|
-
scale: 1
|
|
1998
|
-
// No scale transform - using dimensions
|
|
1999
|
-
}, a = {
|
|
2000
|
-
width: t.offsetWidth,
|
|
2001
|
-
height: t.offsetHeight
|
|
2002
|
-
};
|
|
2003
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2014
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2015
|
+
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2004
2016
|
t,
|
|
2005
2017
|
this.incoming.originalState,
|
|
2006
|
-
|
|
2007
|
-
|
|
2018
|
+
s,
|
|
2019
|
+
r
|
|
2008
2020
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2009
2021
|
return;
|
|
2010
2022
|
}
|
|
@@ -2046,36 +2058,18 @@ class ve {
|
|
|
2046
2058
|
if (this.incoming?.element === t)
|
|
2047
2059
|
return;
|
|
2048
2060
|
if (this.outgoing?.element === t) {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
scale: 1
|
|
2054
|
-
// No scale - using dimensions
|
|
2055
|
-
}, a = {
|
|
2056
|
-
width: t.offsetWidth,
|
|
2057
|
-
height: t.offsetHeight
|
|
2058
|
-
};
|
|
2059
|
-
if (this.incoming) {
|
|
2060
|
-
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), c = {
|
|
2061
|
-
x: h.x,
|
|
2062
|
-
y: h.y,
|
|
2063
|
-
rotation: h.rotation,
|
|
2064
|
-
scale: 1
|
|
2065
|
-
// No scale - using dimensions
|
|
2066
|
-
}, u = {
|
|
2067
|
-
width: this.incoming.element.offsetWidth,
|
|
2068
|
-
height: this.incoming.element.offsetHeight
|
|
2069
|
-
};
|
|
2070
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2061
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2062
|
+
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2063
|
+
const { transform: a, dimensions: h } = this.captureMidAnimationState(this.incoming.element);
|
|
2064
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2071
2065
|
this.incoming.element,
|
|
2072
2066
|
this.incoming.originalState,
|
|
2073
|
-
|
|
2074
|
-
|
|
2067
|
+
a,
|
|
2068
|
+
h
|
|
2075
2069
|
);
|
|
2076
2070
|
} else
|
|
2077
2071
|
this.outgoing = null;
|
|
2078
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2072
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, s, r), await Promise.all([
|
|
2079
2073
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2080
2074
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2081
2075
|
]), this.focusGeneration !== o) return;
|
|
@@ -2089,21 +2083,12 @@ class ve {
|
|
|
2089
2083
|
this.outgoing.originalWidth,
|
|
2090
2084
|
this.outgoing.originalHeight
|
|
2091
2085
|
), this.outgoing = null), this.incoming) {
|
|
2092
|
-
const s = this.
|
|
2093
|
-
|
|
2094
|
-
y: s.y,
|
|
2095
|
-
rotation: s.rotation,
|
|
2096
|
-
scale: 1
|
|
2097
|
-
// No scale - using dimensions
|
|
2098
|
-
}, a = {
|
|
2099
|
-
width: this.incoming.element.offsetWidth,
|
|
2100
|
-
height: this.incoming.element.offsetHeight
|
|
2101
|
-
};
|
|
2102
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2086
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2087
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2103
2088
|
this.incoming.element,
|
|
2104
2089
|
this.incoming.originalState,
|
|
2105
|
-
|
|
2106
|
-
|
|
2090
|
+
s,
|
|
2091
|
+
r
|
|
2107
2092
|
);
|
|
2108
2093
|
}
|
|
2109
2094
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
@@ -2118,50 +2103,36 @@ class ve {
|
|
|
2118
2103
|
* Unfocus current image, returning it to original position
|
|
2119
2104
|
*/
|
|
2120
2105
|
async unfocusImage() {
|
|
2106
|
+
if (this.state === I.UNFOCUSING)
|
|
2107
|
+
return;
|
|
2121
2108
|
const t = ++this.focusGeneration;
|
|
2122
2109
|
if (!this.currentFocus || !this.focusData) {
|
|
2123
2110
|
if (this.incoming && this.state === I.FOCUSING) {
|
|
2124
|
-
const s = this.
|
|
2125
|
-
|
|
2126
|
-
y: s.y,
|
|
2127
|
-
rotation: s.rotation,
|
|
2128
|
-
scale: 1
|
|
2129
|
-
// No scale - using dimensions
|
|
2130
|
-
}, a = {
|
|
2131
|
-
width: this.incoming.element.offsetWidth,
|
|
2132
|
-
height: this.incoming.element.offsetHeight
|
|
2133
|
-
};
|
|
2134
|
-
if (this.outgoing = this.startUnfocusAnimation(
|
|
2111
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2112
|
+
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2135
2113
|
this.incoming.element,
|
|
2136
2114
|
this.incoming.originalState,
|
|
2137
|
-
|
|
2138
|
-
|
|
2115
|
+
s,
|
|
2116
|
+
r
|
|
2139
2117
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2140
2118
|
this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
2141
2119
|
}
|
|
2142
2120
|
return;
|
|
2143
2121
|
}
|
|
2144
2122
|
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2145
|
-
const s = this.
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
rotation: s.rotation,
|
|
2149
|
-
scale: 1
|
|
2150
|
-
// No scale - using dimensions
|
|
2151
|
-
}, a = {
|
|
2152
|
-
width: this.incoming.element.offsetWidth,
|
|
2153
|
-
height: this.incoming.element.offsetHeight
|
|
2154
|
-
}, h = this.startUnfocusAnimation(
|
|
2123
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2124
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2125
|
+
const a = this.startUnfocusAnimation(
|
|
2155
2126
|
this.incoming.element,
|
|
2156
2127
|
this.incoming.originalState,
|
|
2157
|
-
|
|
2158
|
-
|
|
2128
|
+
s,
|
|
2129
|
+
r
|
|
2159
2130
|
);
|
|
2160
2131
|
if (await Promise.all([
|
|
2161
2132
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2162
|
-
this.waitForAnimation(
|
|
2133
|
+
this.waitForAnimation(a.animationHandle)
|
|
2163
2134
|
]), this.focusGeneration !== t) return;
|
|
2164
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(
|
|
2135
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(a.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2165
2136
|
return;
|
|
2166
2137
|
}
|
|
2167
2138
|
this.state = I.UNFOCUSING;
|
|
@@ -2248,7 +2219,7 @@ class ve {
|
|
|
2248
2219
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2249
2220
|
}
|
|
2250
2221
|
}
|
|
2251
|
-
const we = 50, xe = 0.5, Ee = 20, Se = 0.3, Ie = 150,
|
|
2222
|
+
const we = 50, xe = 0.5, Ee = 20, Se = 0.3, Ie = 150, Ae = 30, at = class at {
|
|
2252
2223
|
constructor(t, e) {
|
|
2253
2224
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2254
2225
|
}
|
|
@@ -2295,7 +2266,7 @@ const we = 50, xe = 0.5, Ee = 20, Se = 0.3, Ie = 150, Te = 30, at = class at {
|
|
|
2295
2266
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2296
2267
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2297
2268
|
const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2298
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2269
|
+
this.touchState.isHorizontalSwipe = a <= Ae;
|
|
2299
2270
|
}
|
|
2300
2271
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2301
2272
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
@@ -2315,8 +2286,8 @@ const we = 50, xe = 0.5, Ee = 20, Se = 0.3, Ie = 150, Te = 30, at = class at {
|
|
|
2315
2286
|
}
|
|
2316
2287
|
};
|
|
2317
2288
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2318
|
-
let
|
|
2319
|
-
class
|
|
2289
|
+
let ft = at;
|
|
2290
|
+
class Te {
|
|
2320
2291
|
constructor(t) {
|
|
2321
2292
|
if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2322
2293
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2774,7 +2745,7 @@ class Re {
|
|
|
2774
2745
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2775
2746
|
}
|
|
2776
2747
|
}
|
|
2777
|
-
class
|
|
2748
|
+
class Me {
|
|
2778
2749
|
/**
|
|
2779
2750
|
* Create a new ImageFilter
|
|
2780
2751
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2811,7 +2782,7 @@ class Le {
|
|
|
2811
2782
|
// isAllowedDate(date: Date): boolean
|
|
2812
2783
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2813
2784
|
}
|
|
2814
|
-
const
|
|
2785
|
+
const Le = `
|
|
2815
2786
|
.fbn-ic-gallery {
|
|
2816
2787
|
position: relative;
|
|
2817
2788
|
width: 100%;
|
|
@@ -2866,11 +2837,11 @@ function ze() {
|
|
|
2866
2837
|
const n = "fbn-ic-functional-styles";
|
|
2867
2838
|
if (document.getElementById(n)) return;
|
|
2868
2839
|
const t = document.createElement("style");
|
|
2869
|
-
t.id = n, t.textContent =
|
|
2840
|
+
t.id = n, t.textContent = Le, document.head.appendChild(t);
|
|
2870
2841
|
}
|
|
2871
2842
|
class Fe {
|
|
2872
2843
|
constructor(t = {}) {
|
|
2873
|
-
this.fullConfig = Wt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Xt(this.fullConfig.animation), this.layoutEngine = new
|
|
2844
|
+
this.fullConfig = Wt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Xt(this.fullConfig.animation), this.layoutEngine = new fe({
|
|
2874
2845
|
layout: this.fullConfig.layout,
|
|
2875
2846
|
image: this.fullConfig.image
|
|
2876
2847
|
}), this.zoomEngine = new ve(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = st(this.fullConfig.styling?.default), this.hoverStyles = st(this.fullConfig.styling?.hover), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
@@ -2885,7 +2856,7 @@ class Fe {
|
|
|
2885
2856
|
*/
|
|
2886
2857
|
createImageFilter() {
|
|
2887
2858
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
2888
|
-
return new
|
|
2859
|
+
return new Me(t);
|
|
2889
2860
|
}
|
|
2890
2861
|
/**
|
|
2891
2862
|
* Create appropriate image loader based on config
|
|
@@ -2921,7 +2892,7 @@ class Fe {
|
|
|
2921
2892
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2922
2893
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2923
2894
|
};
|
|
2924
|
-
return new
|
|
2895
|
+
return new Te(o);
|
|
2925
2896
|
} else
|
|
2926
2897
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2927
2898
|
}
|
|
@@ -2934,7 +2905,7 @@ class Fe {
|
|
|
2934
2905
|
this.containerEl = this.containerRef;
|
|
2935
2906
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2936
2907
|
throw new Error(`Container #${this.containerId} not found`);
|
|
2937
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
2908
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new ft(this.containerEl, {
|
|
2938
2909
|
onNext: () => this.navigateToNextImage(),
|
|
2939
2910
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2940
2911
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
@@ -3066,20 +3037,20 @@ class Fe {
|
|
|
3066
3037
|
const d = {
|
|
3067
3038
|
x: parseFloat(c.dataset.startX),
|
|
3068
3039
|
y: parseFloat(c.dataset.startY)
|
|
3069
|
-
},
|
|
3040
|
+
}, m = {
|
|
3070
3041
|
x: parseFloat(c.dataset.endX),
|
|
3071
3042
|
y: parseFloat(c.dataset.endY)
|
|
3072
|
-
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation),
|
|
3043
|
+
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), f = parseFloat(c.dataset.scale), E = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : f, w = this.entryAnimationEngine.getTiming();
|
|
3073
3044
|
ee({
|
|
3074
3045
|
element: c,
|
|
3075
3046
|
startPosition: d,
|
|
3076
|
-
endPosition:
|
|
3047
|
+
endPosition: m,
|
|
3077
3048
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3078
3049
|
duration: w.duration,
|
|
3079
3050
|
imageWidth: b,
|
|
3080
3051
|
imageHeight: p,
|
|
3081
3052
|
rotation: g,
|
|
3082
|
-
scale:
|
|
3053
|
+
scale: f,
|
|
3083
3054
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3084
3055
|
startRotation: E,
|
|
3085
3056
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
@@ -3136,8 +3107,8 @@ class Fe {
|
|
|
3136
3107
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
|
|
3137
3108
|
const l = document.createElement("div");
|
|
3138
3109
|
l.className = "fbn-ic-debug-center", l.style.position = "absolute", l.style.width = "12px", l.style.height = "12px", l.style.borderRadius = "50%", l.style.backgroundColor = "red", l.style.border = "2px solid yellow", l.style.zIndex = "9999", l.style.pointerEvents = "none";
|
|
3139
|
-
const d = c.x,
|
|
3140
|
-
l.style.left = `${d - 6}px`, l.style.top = `${
|
|
3110
|
+
const d = c.x, m = c.y;
|
|
3111
|
+
l.style.left = `${d - 6}px`, l.style.top = `${m - 6}px`, l.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(m)})`, this.containerEl.appendChild(l);
|
|
3141
3112
|
})), t.forEach((c, u) => {
|
|
3142
3113
|
const l = document.createElement("img");
|
|
3143
3114
|
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(u);
|
|
@@ -3146,14 +3117,14 @@ class Fe {
|
|
|
3146
3117
|
this.hoveredImage = { element: l, layout: d }, this.zoomEngine.isInvolved(l) || (tt(l, this.hoverStyles), et(l, this.hoverClassName));
|
|
3147
3118
|
}), l.addEventListener("mouseleave", () => {
|
|
3148
3119
|
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles), Ft(l, this.hoverClassName), et(l, this.defaultClassName));
|
|
3149
|
-
}), l.addEventListener("click", (
|
|
3150
|
-
|
|
3120
|
+
}), l.addEventListener("click", (m) => {
|
|
3121
|
+
m.stopPropagation(), this.handleImageClick(l, d);
|
|
3151
3122
|
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3152
3123
|
if (o !== this.loadGeneration)
|
|
3153
3124
|
return;
|
|
3154
|
-
const
|
|
3125
|
+
const m = l.naturalWidth / l.naturalHeight, b = e * m;
|
|
3155
3126
|
l.style.width = `${b}px`;
|
|
3156
|
-
const p = { x: d.x, y: d.y }, g = { width: b, height: e },
|
|
3127
|
+
const p = { x: d.x, y: d.y }, g = { width: b, height: e }, f = this.entryAnimationEngine.calculateStartPosition(
|
|
3157
3128
|
p,
|
|
3158
3129
|
g,
|
|
3159
3130
|
i,
|
|
@@ -3165,7 +3136,7 @@ class Fe {
|
|
|
3165
3136
|
b,
|
|
3166
3137
|
e
|
|
3167
3138
|
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3168
|
-
|
|
3139
|
+
f,
|
|
3169
3140
|
p,
|
|
3170
3141
|
d.rotation,
|
|
3171
3142
|
d.scale,
|
|
@@ -3182,7 +3153,7 @@ class Fe {
|
|
|
3182
3153
|
finalTransform: w,
|
|
3183
3154
|
renderedWidth: b,
|
|
3184
3155
|
renderedHeight: e
|
|
3185
|
-
}), l.style.transform = S, l.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || v !== d.scale) && (l.dataset.startX = String(
|
|
3156
|
+
}), l.style.transform = S, l.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || v !== d.scale) && (l.dataset.startX = String(f.x), l.dataset.startY = String(f.y), l.dataset.endX = String(p.x), l.dataset.endY = String(p.y), l.dataset.imageWidth = String(b), l.dataset.imageHeight = String(e), l.dataset.rotation = String(d.rotation), l.dataset.scale = String(d.scale), l.dataset.startRotation = String(E), l.dataset.startScale = String(v)), this.displayQueue.push(l);
|
|
3186
3157
|
}, l.onerror = () => r++, l.src = c;
|
|
3187
3158
|
});
|
|
3188
3159
|
}
|