catchup-library-web 1.21.9 → 1.21.10
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
|
@@ -5819,32 +5819,37 @@ var MatchingActivityMaterialContent = ({
|
|
|
5819
5819
|
).answerMap = materialMap;
|
|
5820
5820
|
}, [showCorrectAnswer, answer, materialMap]);
|
|
5821
5821
|
(0, import_react21.useEffect)(() => {
|
|
5822
|
-
if (dropTargetKey
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5822
|
+
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
5823
|
+
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
5824
|
+
if (!dropZoneElement) return;
|
|
5825
|
+
const rect = dropZoneElement.getBoundingClientRect();
|
|
5826
|
+
const elementTop = rect.top + window.scrollY;
|
|
5827
|
+
const elementHeight = rect.height;
|
|
5828
|
+
const viewportHeight = window.innerHeight;
|
|
5829
|
+
const targetScroll = elementTop - viewportHeight / 2 + elementHeight / 2;
|
|
5830
|
+
const startScroll = window.scrollY;
|
|
5831
|
+
const distance = targetScroll - startScroll;
|
|
5832
|
+
console.log("Scrolling to element:", dropTargetKey);
|
|
5833
|
+
console.log("Current scroll:", startScroll);
|
|
5834
|
+
console.log("Target scroll:", targetScroll);
|
|
5835
|
+
console.log("Distance:", distance);
|
|
5836
|
+
if (Math.abs(distance) < 10) return;
|
|
5837
|
+
const duration = 800;
|
|
5838
|
+
let startTime = null;
|
|
5839
|
+
const easeInOutQuad = (t) => {
|
|
5840
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
5841
|
+
};
|
|
5842
|
+
const animate = (currentTime) => {
|
|
5843
|
+
if (startTime === null) startTime = currentTime;
|
|
5844
|
+
const elapsed = currentTime - startTime;
|
|
5845
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
5846
|
+
const easedProgress = easeInOutQuad(progress);
|
|
5847
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
5848
|
+
if (progress < 1) {
|
|
5849
|
+
requestAnimationFrame(animate);
|
|
5846
5850
|
}
|
|
5847
|
-
}
|
|
5851
|
+
};
|
|
5852
|
+
requestAnimationFrame(animate);
|
|
5848
5853
|
}, [dropTargetKey]);
|
|
5849
5854
|
const retrieveAnswerMap = () => {
|
|
5850
5855
|
const foundIndex = answer.data.findIndex(
|
package/dist/index.mjs
CHANGED
|
@@ -5603,32 +5603,37 @@ var MatchingActivityMaterialContent = ({
|
|
|
5603
5603
|
).answerMap = materialMap;
|
|
5604
5604
|
}, [showCorrectAnswer, answer, materialMap]);
|
|
5605
5605
|
useEffect11(() => {
|
|
5606
|
-
if (dropTargetKey
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5606
|
+
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
5607
|
+
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
5608
|
+
if (!dropZoneElement) return;
|
|
5609
|
+
const rect = dropZoneElement.getBoundingClientRect();
|
|
5610
|
+
const elementTop = rect.top + window.scrollY;
|
|
5611
|
+
const elementHeight = rect.height;
|
|
5612
|
+
const viewportHeight = window.innerHeight;
|
|
5613
|
+
const targetScroll = elementTop - viewportHeight / 2 + elementHeight / 2;
|
|
5614
|
+
const startScroll = window.scrollY;
|
|
5615
|
+
const distance = targetScroll - startScroll;
|
|
5616
|
+
console.log("Scrolling to element:", dropTargetKey);
|
|
5617
|
+
console.log("Current scroll:", startScroll);
|
|
5618
|
+
console.log("Target scroll:", targetScroll);
|
|
5619
|
+
console.log("Distance:", distance);
|
|
5620
|
+
if (Math.abs(distance) < 10) return;
|
|
5621
|
+
const duration = 800;
|
|
5622
|
+
let startTime = null;
|
|
5623
|
+
const easeInOutQuad = (t) => {
|
|
5624
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
5625
|
+
};
|
|
5626
|
+
const animate = (currentTime) => {
|
|
5627
|
+
if (startTime === null) startTime = currentTime;
|
|
5628
|
+
const elapsed = currentTime - startTime;
|
|
5629
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
5630
|
+
const easedProgress = easeInOutQuad(progress);
|
|
5631
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
5632
|
+
if (progress < 1) {
|
|
5633
|
+
requestAnimationFrame(animate);
|
|
5630
5634
|
}
|
|
5631
|
-
}
|
|
5635
|
+
};
|
|
5636
|
+
requestAnimationFrame(animate);
|
|
5632
5637
|
}, [dropTargetKey]);
|
|
5633
5638
|
const retrieveAnswerMap = () => {
|
|
5634
5639
|
const foundIndex = answer.data.findIndex(
|
package/package.json
CHANGED
|
@@ -63,42 +63,52 @@ const MatchingActivityMaterialContent = ({
|
|
|
63
63
|
}, [showCorrectAnswer, answer, materialMap]);
|
|
64
64
|
|
|
65
65
|
useEffect(() => {
|
|
66
|
-
if (dropTargetKey
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
66
|
+
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
67
|
+
|
|
68
|
+
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
69
|
+
if (!dropZoneElement) return;
|
|
70
|
+
|
|
71
|
+
// Get the element's position relative to the viewport
|
|
72
|
+
const rect = dropZoneElement.getBoundingClientRect();
|
|
73
|
+
const elementTop = rect.top + window.scrollY;
|
|
74
|
+
const elementHeight = rect.height;
|
|
75
|
+
const viewportHeight = window.innerHeight;
|
|
76
|
+
|
|
77
|
+
// Calculate target scroll position (center the element in viewport)
|
|
78
|
+
const targetScroll = elementTop - viewportHeight / 2 + elementHeight / 2;
|
|
79
|
+
const startScroll = window.scrollY;
|
|
80
|
+
const distance = targetScroll - startScroll;
|
|
81
|
+
|
|
82
|
+
console.log("Scrolling to element:", dropTargetKey);
|
|
83
|
+
console.log("Current scroll:", startScroll);
|
|
84
|
+
console.log("Target scroll:", targetScroll);
|
|
85
|
+
console.log("Distance:", distance);
|
|
86
|
+
|
|
87
|
+
// Don't animate if already roughly in position
|
|
88
|
+
if (Math.abs(distance) < 10) return;
|
|
89
|
+
|
|
90
|
+
const duration = 800;
|
|
91
|
+
let startTime: number | null = null;
|
|
92
|
+
|
|
93
|
+
const easeInOutQuad = (t: number): number => {
|
|
94
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const animate = (currentTime: number) => {
|
|
98
|
+
if (startTime === null) startTime = currentTime;
|
|
99
|
+
|
|
100
|
+
const elapsed = currentTime - startTime;
|
|
101
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
102
|
+
const easedProgress = easeInOutQuad(progress);
|
|
103
|
+
|
|
104
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
105
|
+
|
|
106
|
+
if (progress < 1) {
|
|
107
|
+
requestAnimationFrame(animate);
|
|
100
108
|
}
|
|
101
|
-
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
requestAnimationFrame(animate);
|
|
102
112
|
}, [dropTargetKey]);
|
|
103
113
|
|
|
104
114
|
const retrieveAnswerMap = () => {
|