catchup-library-web 1.21.9 → 1.21.11
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,41 @@ 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
|
+
console.log("startTime:", startTime);
|
|
5845
|
+
const elapsed = currentTime - startTime;
|
|
5846
|
+
console.log("elapsed:", elapsed);
|
|
5847
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
5848
|
+
console.log("progress:", progress);
|
|
5849
|
+
const easedProgress = easeInOutQuad(progress);
|
|
5850
|
+
console.log("eased progressed: ", easedProgress);
|
|
5851
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
5852
|
+
if (progress < 1) {
|
|
5853
|
+
requestAnimationFrame(animate);
|
|
5846
5854
|
}
|
|
5847
|
-
}
|
|
5855
|
+
};
|
|
5856
|
+
requestAnimationFrame(animate);
|
|
5848
5857
|
}, [dropTargetKey]);
|
|
5849
5858
|
const retrieveAnswerMap = () => {
|
|
5850
5859
|
const foundIndex = answer.data.findIndex(
|
package/dist/index.mjs
CHANGED
|
@@ -5603,32 +5603,41 @@ 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
|
+
console.log("startTime:", startTime);
|
|
5629
|
+
const elapsed = currentTime - startTime;
|
|
5630
|
+
console.log("elapsed:", elapsed);
|
|
5631
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
5632
|
+
console.log("progress:", progress);
|
|
5633
|
+
const easedProgress = easeInOutQuad(progress);
|
|
5634
|
+
console.log("eased progressed: ", easedProgress);
|
|
5635
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
5636
|
+
if (progress < 1) {
|
|
5637
|
+
requestAnimationFrame(animate);
|
|
5630
5638
|
}
|
|
5631
|
-
}
|
|
5639
|
+
};
|
|
5640
|
+
requestAnimationFrame(animate);
|
|
5632
5641
|
}, [dropTargetKey]);
|
|
5633
5642
|
const retrieveAnswerMap = () => {
|
|
5634
5643
|
const foundIndex = answer.data.findIndex(
|
package/package.json
CHANGED
|
@@ -63,42 +63,56 @@ 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
|
+
console.log("startTime:", startTime);
|
|
101
|
+
const elapsed = currentTime - startTime;
|
|
102
|
+
console.log("elapsed:", elapsed);
|
|
103
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
104
|
+
console.log("progress:", progress);
|
|
105
|
+
const easedProgress = easeInOutQuad(progress);
|
|
106
|
+
console.log("eased progressed: ", easedProgress);
|
|
107
|
+
|
|
108
|
+
window.scrollTo(0, startScroll + distance * easedProgress);
|
|
109
|
+
|
|
110
|
+
if (progress < 1) {
|
|
111
|
+
requestAnimationFrame(animate);
|
|
100
112
|
}
|
|
101
|
-
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
requestAnimationFrame(animate);
|
|
102
116
|
}, [dropTargetKey]);
|
|
103
117
|
|
|
104
118
|
const retrieveAnswerMap = () => {
|