catchup-library-web 1.21.4 → 1.21.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -5393,7 +5393,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5393
5393
|
if (dropZoneElement) {
|
|
5394
5394
|
dropZoneElement.scrollIntoView({
|
|
5395
5395
|
behavior: "smooth",
|
|
5396
|
-
block: "
|
|
5396
|
+
block: "center"
|
|
5397
5397
|
});
|
|
5398
5398
|
}
|
|
5399
5399
|
}
|
|
@@ -5805,10 +5805,22 @@ var MatchingActivityMaterialContent = ({
|
|
|
5805
5805
|
if (dropTargetKey && dropZoneRefs.current[dropTargetKey]) {
|
|
5806
5806
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
5807
5807
|
if (dropZoneElement) {
|
|
5808
|
-
dropZoneElement.
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5808
|
+
const targetPosition = dropZoneElement.getBoundingClientRect().top + window.pageYOffset;
|
|
5809
|
+
const startPosition = window.pageYOffset;
|
|
5810
|
+
const distance = targetPosition - startPosition - window.innerHeight / 2 + dropZoneElement.offsetHeight / 2;
|
|
5811
|
+
const duration = 1e3;
|
|
5812
|
+
let start = null;
|
|
5813
|
+
const animation = (currentTime) => {
|
|
5814
|
+
if (start === null) start = currentTime;
|
|
5815
|
+
const timeElapsed = currentTime - start;
|
|
5816
|
+
const progress = Math.min(timeElapsed / duration, 1);
|
|
5817
|
+
const ease = (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
5818
|
+
window.scrollTo(0, startPosition + distance * ease(progress));
|
|
5819
|
+
if (timeElapsed < duration) {
|
|
5820
|
+
requestAnimationFrame(animation);
|
|
5821
|
+
}
|
|
5822
|
+
};
|
|
5823
|
+
requestAnimationFrame(animation);
|
|
5812
5824
|
}
|
|
5813
5825
|
}
|
|
5814
5826
|
}, [dropTargetKey]);
|
package/dist/index.mjs
CHANGED
|
@@ -5177,7 +5177,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5177
5177
|
if (dropZoneElement) {
|
|
5178
5178
|
dropZoneElement.scrollIntoView({
|
|
5179
5179
|
behavior: "smooth",
|
|
5180
|
-
block: "
|
|
5180
|
+
block: "center"
|
|
5181
5181
|
});
|
|
5182
5182
|
}
|
|
5183
5183
|
}
|
|
@@ -5589,10 +5589,22 @@ var MatchingActivityMaterialContent = ({
|
|
|
5589
5589
|
if (dropTargetKey && dropZoneRefs.current[dropTargetKey]) {
|
|
5590
5590
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
5591
5591
|
if (dropZoneElement) {
|
|
5592
|
-
dropZoneElement.
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5592
|
+
const targetPosition = dropZoneElement.getBoundingClientRect().top + window.pageYOffset;
|
|
5593
|
+
const startPosition = window.pageYOffset;
|
|
5594
|
+
const distance = targetPosition - startPosition - window.innerHeight / 2 + dropZoneElement.offsetHeight / 2;
|
|
5595
|
+
const duration = 1e3;
|
|
5596
|
+
let start = null;
|
|
5597
|
+
const animation = (currentTime) => {
|
|
5598
|
+
if (start === null) start = currentTime;
|
|
5599
|
+
const timeElapsed = currentTime - start;
|
|
5600
|
+
const progress = Math.min(timeElapsed / duration, 1);
|
|
5601
|
+
const ease = (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
5602
|
+
window.scrollTo(0, startPosition + distance * ease(progress));
|
|
5603
|
+
if (timeElapsed < duration) {
|
|
5604
|
+
requestAnimationFrame(animation);
|
|
5605
|
+
}
|
|
5606
|
+
};
|
|
5607
|
+
requestAnimationFrame(animation);
|
|
5596
5608
|
}
|
|
5597
5609
|
}
|
|
5598
5610
|
}, [dropTargetKey]);
|
package/package.json
CHANGED
|
@@ -66,10 +66,34 @@ const MatchingActivityMaterialContent = ({
|
|
|
66
66
|
if (dropTargetKey && dropZoneRefs.current[dropTargetKey]) {
|
|
67
67
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
68
68
|
if (dropZoneElement) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const targetPosition =
|
|
70
|
+
dropZoneElement.getBoundingClientRect().top + window.pageYOffset;
|
|
71
|
+
const startPosition = window.pageYOffset;
|
|
72
|
+
const distance =
|
|
73
|
+
targetPosition -
|
|
74
|
+
startPosition -
|
|
75
|
+
window.innerHeight / 2 +
|
|
76
|
+
dropZoneElement.offsetHeight / 2;
|
|
77
|
+
const duration = 1000;
|
|
78
|
+
let start: number | null = null;
|
|
79
|
+
|
|
80
|
+
const animation = (currentTime: number) => {
|
|
81
|
+
if (start === null) start = currentTime;
|
|
82
|
+
const timeElapsed = currentTime - start;
|
|
83
|
+
const progress = Math.min(timeElapsed / duration, 1);
|
|
84
|
+
|
|
85
|
+
// Easing function for smooth animation
|
|
86
|
+
const ease = (t: number) =>
|
|
87
|
+
t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
88
|
+
|
|
89
|
+
window.scrollTo(0, startPosition + distance * ease(progress));
|
|
90
|
+
|
|
91
|
+
if (timeElapsed < duration) {
|
|
92
|
+
requestAnimationFrame(animation);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
requestAnimationFrame(animation);
|
|
73
97
|
}
|
|
74
98
|
}
|
|
75
99
|
}, [dropTargetKey]);
|