lido-player 0.0.2-beta-22-dev → 0.0.2-beta-24-dev
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/LICENSE +21 -21
- package/dist/cjs/{decode-Cr5DANqc.js → decode-B7mZm_nK.js} +1 -1
- package/dist/cjs/{index-0BvcfeCt.js → index-BCRDjbaz.js} +276 -98
- package/dist/cjs/{index-DnaH8sO-.js → index-DBCFoh1I.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +231 -59
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +9 -2
- package/dist/collection/components/avatar/lido-avatar.tsx +214 -207
- package/dist/collection/components/avatar/readme.md +49 -49
- package/dist/collection/components/calculator/lido-calculator.css +89 -89
- package/dist/collection/components/calculator/lido-calculator.js +2 -2
- package/dist/collection/components/canvas/lido-canvas.css +33 -33
- package/dist/collection/components/canvas/lido-canvas.js +1 -1
- package/dist/collection/components/cell/lido-cell.css +100 -100
- package/dist/collection/components/cell/lido-cell.js +12 -12
- package/dist/collection/components/column/lido-col.css +19 -19
- package/dist/collection/components/column/lido-col.js +6 -6
- package/dist/collection/components/container/lido-container.css +34 -10
- package/dist/collection/components/container/lido-container.js +39 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +72 -46
- package/dist/collection/components/flashCard/lido-flash-card.js +156 -15
- package/dist/collection/components/float/lido-float.css +30 -30
- package/dist/collection/components/float/lido-float.js +2 -2
- package/dist/collection/components/home/lido-home.css +309 -309
- package/dist/collection/components/home/lido-home.js +5 -5
- package/dist/collection/components/image/lido-image.css +17 -17
- package/dist/collection/components/image/lido-image.js +6 -6
- package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
- package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +1 -1
- package/dist/collection/components/position/lido-pos.css +16 -16
- package/dist/collection/components/position/lido-pos.js +2 -2
- package/dist/collection/components/random/lido-random.css +8 -8
- package/dist/collection/components/random/lido-random.js +2 -2
- package/dist/collection/components/root/lido-root.js +5 -5
- package/dist/collection/components/row/lido-row.css +10 -10
- package/dist/collection/components/row/lido-row.js +6 -6
- package/dist/collection/components/scale/assets/Shadow.svg +9 -9
- package/dist/collection/components/scale/lido-balance.css +174 -174
- package/dist/collection/components/scale/lido-balance.js +13 -13
- package/dist/collection/components/shape/lido-shape.css +216 -216
- package/dist/collection/components/shape/lido-shape.js +6 -6
- package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
- package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
- package/dist/collection/components/text/lido-text.css +53 -53
- package/dist/collection/components/text/lido-text.js +5 -5
- package/dist/collection/components/trace/assets/Tracing-hand.svg +8 -8
- package/dist/collection/components/trace/lido-trace.css +97 -97
- package/dist/collection/components/trace/lido-trace.js +7 -14
- package/dist/collection/components/wrap/lido-wrap.css +18 -18
- package/dist/collection/components/wrap/lido-wrap.js +6 -6
- package/dist/collection/css/animation.css +211 -211
- package/dist/collection/css/index.css +323 -323
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +61 -61
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +48 -48
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +39 -39
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +44 -44
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +35 -35
- package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
- package/dist/collection/stories/Templates/blender/blender.stories.js +59 -59
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +28 -28
- package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
- package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +29 -29
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
- package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +43 -43
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +35 -35
- package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
- package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +44 -44
- package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
- package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +84 -84
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +31 -31
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +57 -57
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +53 -53
- package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +46 -46
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +45 -45
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +56 -56
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +53 -53
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +127 -127
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +47 -47
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +38 -38
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +97 -97
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +90 -90
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +45 -45
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +79 -79
- package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +32 -32
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +42 -42
- package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +44 -44
- package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +34 -34
- package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +52 -52
- package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +33 -33
- package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +40 -40
- package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +48 -48
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +48 -48
- package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +18 -18
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +44 -44
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +34 -34
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +36 -36
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +30 -30
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
- package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +58 -58
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
- package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +631 -631
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +47 -47
- package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +29 -29
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +64 -64
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -62
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +106 -106
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +50 -50
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
- package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +62 -62
- package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +42 -42
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +50 -50
- package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +88 -88
- package/dist/collection/stories/Templates/total/total.stories.js +28 -28
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +35 -35
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +34 -34
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +31 -31
- package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +58 -58
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -44
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +31 -31
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +34 -34
- package/dist/collection/stories/components/flash-card.stories.js +48 -48
- package/dist/collection/stories/components/keyboard.stories.js +10 -10
- package/dist/collection/stories/components/slider.stories.js +4 -4
- package/dist/collection/stories/components/trace.stories.js +5 -5
- package/dist/collection/utils/audioPlayer.js +7 -4
- package/dist/collection/utils/utils.js +70 -14
- package/dist/collection/utils/utilsHandlers/clickHandler.js +4 -3
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +137 -28
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +56 -56
- package/dist/collection/utils/utilsHandlers/slideHandler.js +17 -8
- package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/p-B-mIxynb.js +1 -0
- package/dist/components/{p-DdQ1eqJr.js → p-B8nzzM8c.js} +1 -1
- package/dist/components/{p-D2GhaM-T.js → p-Bv1hunWk.js} +1 -1
- package/dist/components/{p-DDS30M3y.js → p-C-pHQRbp.js} +1 -1
- package/dist/components/{p-CPYnt0P-.js → p-C5WmmkI6.js} +1 -1
- package/dist/components/{p-useuhkjH.js → p-C70ykycD.js} +1 -1
- package/dist/components/{p-CFzvgrMa.js → p-CFPSty2U.js} +1 -1
- package/dist/components/p-CFWohOId.js +1 -0
- package/dist/components/{p-BfwUqpXc.js → p-CTlcpv4a.js} +1 -1
- package/dist/components/{p-CyGxEcn7.js → p-CXHPZN3m.js} +1 -1
- package/dist/components/{p-Bw-OC9iR.js → p-CgsPIpg0.js} +1 -1
- package/dist/components/{p-ChfVUoX4.js → p-CsDu4kiC.js} +1 -1
- package/dist/components/{p-CwDTdXe5.js → p-DG0KR2iN.js} +1 -1
- package/dist/components/p-DLyacZap.js +1 -0
- package/dist/components/{p-BiBt9LGP.js → p-DNo3iX_r.js} +1 -1
- package/dist/components/p-DONbWJGn.js +1 -0
- package/dist/components/p-DXy70SGv.js +1 -0
- package/dist/components/{p-CkxAm8rY.js → p-DfjbSSI2.js} +2 -2
- package/dist/components/{p-BJiyBHYT.js → p-Gwko4CTL.js} +1 -1
- package/dist/components/p-uuyVO2B1.js +1 -0
- package/dist/esm/{decode-DkSXjv7K.js → decode-CyhHNDvT.js} +1 -1
- package/dist/esm/{index-D9-TTsdZ.js → index-CndbFQ5I.js} +276 -98
- package/dist/esm/{index-Dvjbti-h.js → index-mMpK8062.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +231 -59
- package/dist/esm/lido-player.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/lido-player/assets/Shadow.svg +9 -9
- package/dist/lido-player/assets/Tracing-hand.svg +8 -8
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-avatar.css +4 -4
- package/dist/lido-player/lido-avatar.tsx +214 -207
- package/dist/lido-player/lido-player.css +7 -7
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-77iyGppv.js +1 -0
- package/dist/lido-player/p-d760e67b.entry.js +12 -0
- package/dist/lido-player/{p-Dc8j8Hxw.js → p-etMb7U6W.js} +1 -1
- package/dist/lido-player/p-mMpK8062.js +2 -0
- package/dist/lido-player/readme.md +49 -49
- package/dist/types/components/container/lido-container.d.ts +4 -0
- package/dist/types/components/flashCard/lido-flash-card.d.ts +17 -0
- package/dist/types/types/json.d.ts +3 -3
- package/dist/types/utils/audioPlayer.d.ts +2 -1
- package/dist/types/utils/utils.d.ts +5 -1
- package/dist/types/utils/utilsHandlers/clickHandler.d.ts +1 -0
- package/dist/types/utils/utilsHandlers/slideHandler.d.ts +1 -1
- package/package.json +73 -74
- package/readme.md +113 -113
- package/dist/components/p-BUfCIPRa.js +0 -1
- package/dist/components/p-DP6jQ5ML.js +0 -1
- package/dist/components/p-DZRNZCPt.js +0 -1
- package/dist/components/p-DbR5sNOj.js +0 -1
- package/dist/components/p-leIEepjl.js +0 -1
- package/dist/components/p-u3czV7QM.js +0 -1
- package/dist/lido-player/p-35fa0b8b.entry.js +0 -12
- package/dist/lido-player/p-D2iINRNN.js +0 -1
- package/dist/lido-player/p-Dvjbti-h.js +0 -2
|
@@ -62,6 +62,19 @@ export function enableDraggingWithScaling(element) {
|
|
|
62
62
|
let clone = null;
|
|
63
63
|
let duplicateElement = null;
|
|
64
64
|
let mutationFlag = false;
|
|
65
|
+
let pendingMoveFrame = null;
|
|
66
|
+
let latestClientX = 0;
|
|
67
|
+
let latestClientY = 0;
|
|
68
|
+
let hasPendingMove = false;
|
|
69
|
+
let touchTransformUpdated = false;
|
|
70
|
+
let touchDragScale = 1;
|
|
71
|
+
let touchDragScaleY = 1;
|
|
72
|
+
let touchOffsetX = 0;
|
|
73
|
+
let touchOffsetY = 0;
|
|
74
|
+
let touchStartElementLeft = 0;
|
|
75
|
+
let touchStartElementTop = 0;
|
|
76
|
+
let touchStartRect = null;
|
|
77
|
+
let isTouchDragging = false;
|
|
65
78
|
// Fetch the container element
|
|
66
79
|
const container = document.getElementById(LidoContainer);
|
|
67
80
|
if (!container) {
|
|
@@ -74,6 +87,33 @@ export function enableDraggingWithScaling(element) {
|
|
|
74
87
|
let verticalDistance;
|
|
75
88
|
let horizontalDistance;
|
|
76
89
|
let dragingElementTransform;
|
|
90
|
+
const getContainerScale = () => {
|
|
91
|
+
const transform = window.getComputedStyle(container).transform;
|
|
92
|
+
const matrix3dMatch = transform.match(/matrix3d\(([^)]+)\)/);
|
|
93
|
+
const matrixMatch = transform.match(/matrix\(([^)]+)\)/);
|
|
94
|
+
if (matrix3dMatch) {
|
|
95
|
+
const values = matrix3dMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
96
|
+
return {
|
|
97
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
98
|
+
scaleY: Math.sqrt(values[4] ** 2 + values[5] ** 2) || 1,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (matrixMatch) {
|
|
102
|
+
const values = matrixMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
103
|
+
return {
|
|
104
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
105
|
+
scaleY: Math.sqrt(values[2] ** 2 + values[3] ** 2) || 1,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return { scaleX: 1, scaleY: 1 };
|
|
109
|
+
};
|
|
110
|
+
const updateTouchDragScale = () => {
|
|
111
|
+
if (isTouchDragging) {
|
|
112
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
113
|
+
touchDragScale = scaleX;
|
|
114
|
+
touchDragScaleY = scaleY;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
77
117
|
const onStart = (event) => {
|
|
78
118
|
var _a, _b;
|
|
79
119
|
if (container && container.getAttribute("game-completed") === "true")
|
|
@@ -90,17 +130,29 @@ export function enableDraggingWithScaling(element) {
|
|
|
90
130
|
if (event instanceof MouseEvent) {
|
|
91
131
|
startX = event.clientX;
|
|
92
132
|
startY = event.clientY;
|
|
133
|
+
touchStartRect = null;
|
|
93
134
|
}
|
|
94
135
|
else {
|
|
95
136
|
startX = event.touches[0].clientX;
|
|
96
137
|
startY = event.touches[0].clientY;
|
|
138
|
+
isTouchDragging = true;
|
|
139
|
+
touchStartRect = element.getBoundingClientRect();
|
|
140
|
+
touchOffsetX = startX - touchStartRect.left;
|
|
141
|
+
touchOffsetY = startY - touchStartRect.top;
|
|
142
|
+
touchStartElementLeft = touchStartRect.left;
|
|
143
|
+
touchStartElementTop = touchStartRect.top;
|
|
144
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
145
|
+
touchDragScale = scaleX;
|
|
146
|
+
touchDragScaleY = scaleY;
|
|
147
|
+
element.style.willChange = 'transform';
|
|
148
|
+
window.addEventListener('resize', updateTouchDragScale);
|
|
97
149
|
}
|
|
98
150
|
// Apply dragging styles to the element
|
|
99
151
|
element.style.opacity = '1';
|
|
100
152
|
element.style.cursor = 'grabbing';
|
|
101
153
|
if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
|
|
102
154
|
const computedStyle = window.getComputedStyle(element);
|
|
103
|
-
const rect = element.getBoundingClientRect();
|
|
155
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
104
156
|
if (!clone) {
|
|
105
157
|
clone = element.cloneNode(true);
|
|
106
158
|
clone.style.left = `${rect.left}px`;
|
|
@@ -119,7 +171,7 @@ export function enableDraggingWithScaling(element) {
|
|
|
119
171
|
const imgElement = element.querySelector('img');
|
|
120
172
|
const src = imgElement === null || imgElement === void 0 ? void 0 : imgElement.getAttribute('src');
|
|
121
173
|
const computedStyle = window.getComputedStyle(element);
|
|
122
|
-
const rect = element.getBoundingClientRect();
|
|
174
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
123
175
|
if (!duplicateElement) {
|
|
124
176
|
duplicateElement = element.cloneNode(false);
|
|
125
177
|
duplicateElement.setAttribute('src', src);
|
|
@@ -196,31 +248,31 @@ export function enableDraggingWithScaling(element) {
|
|
|
196
248
|
target.style.opacity = value;
|
|
197
249
|
}
|
|
198
250
|
};
|
|
199
|
-
const
|
|
200
|
-
|
|
251
|
+
const processMove = () => {
|
|
252
|
+
pendingMoveFrame = null;
|
|
253
|
+
if (!isDragging || !hasPendingMove)
|
|
201
254
|
return;
|
|
255
|
+
hasPendingMove = false;
|
|
256
|
+
const deferTouchDropValidation = touchTransformUpdated;
|
|
202
257
|
if (isDraggingDisabled) {
|
|
203
258
|
isDragging = false;
|
|
259
|
+
touchTransformUpdated = false;
|
|
204
260
|
return;
|
|
205
261
|
}
|
|
206
|
-
isClicked = false;
|
|
207
262
|
element.style.transition = 'none';
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
263
|
+
if (!touchTransformUpdated) {
|
|
264
|
+
const containerScale = calculateScale();
|
|
265
|
+
const dx = (latestClientX - startX) / containerScale;
|
|
266
|
+
const dy = (latestClientY - startY) / containerScale;
|
|
267
|
+
// Calculate the new position considering scaling
|
|
268
|
+
const newLeft = initialX + dx;
|
|
269
|
+
const newTop = initialY + dy;
|
|
270
|
+
// Apply transform with translation without boundaries
|
|
271
|
+
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
214
272
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
// Calculate the new position considering scaling
|
|
220
|
-
const newLeft = initialX + dx;
|
|
221
|
-
const newTop = initialY + dy;
|
|
222
|
-
// Apply transform with translation without boundaries
|
|
223
|
-
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
273
|
+
touchTransformUpdated = false;
|
|
274
|
+
if (deferTouchDropValidation)
|
|
275
|
+
return;
|
|
224
276
|
// Check for overlaps and highlight only the most overlapping element
|
|
225
277
|
let mostOverlappedElement = findMostoverlappedElement(element, 'drop');
|
|
226
278
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -259,6 +311,44 @@ export function enableDraggingWithScaling(element) {
|
|
|
259
311
|
}
|
|
260
312
|
}
|
|
261
313
|
};
|
|
314
|
+
const onMove = (event) => {
|
|
315
|
+
if (!isDragging)
|
|
316
|
+
return;
|
|
317
|
+
if (isDraggingDisabled) {
|
|
318
|
+
isDragging = false;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (event instanceof MouseEvent) {
|
|
322
|
+
touchTransformUpdated = false;
|
|
323
|
+
latestClientX = event.clientX;
|
|
324
|
+
latestClientY = event.clientY;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
const touch = event.touches[0];
|
|
328
|
+
if (!touch)
|
|
329
|
+
return;
|
|
330
|
+
latestClientX = touch.clientX;
|
|
331
|
+
latestClientY = touch.clientY;
|
|
332
|
+
}
|
|
333
|
+
if (!(event instanceof MouseEvent)) {
|
|
334
|
+
element.style.transition = 'none';
|
|
335
|
+
const desiredLeft = latestClientX - touchOffsetX;
|
|
336
|
+
const desiredTop = latestClientY - touchOffsetY;
|
|
337
|
+
const dx = (desiredLeft - touchStartElementLeft) / touchDragScale;
|
|
338
|
+
const dy = (desiredTop - touchStartElementTop) / touchDragScaleY;
|
|
339
|
+
const newLeft = initialX + dx;
|
|
340
|
+
const newTop = initialY + dy;
|
|
341
|
+
element.style.transform = `translate3d(${newLeft}px, ${newTop}px, 0)`;
|
|
342
|
+
touchTransformUpdated = true;
|
|
343
|
+
}
|
|
344
|
+
isClicked = false;
|
|
345
|
+
if (event instanceof MouseEvent) {
|
|
346
|
+
hasPendingMove = true;
|
|
347
|
+
if (pendingMoveFrame === null) {
|
|
348
|
+
pendingMoveFrame = requestAnimationFrame(processMove);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
262
352
|
let lastOverlappedElement = null;
|
|
263
353
|
const removeDocumentDragListeners = () => {
|
|
264
354
|
document.removeEventListener('mousemove', onMove);
|
|
@@ -266,9 +356,19 @@ export function enableDraggingWithScaling(element) {
|
|
|
266
356
|
document.removeEventListener('touchmove', onMove);
|
|
267
357
|
document.removeEventListener('touchend', onEnd);
|
|
268
358
|
};
|
|
359
|
+
const flushPendingMove = () => {
|
|
360
|
+
if (pendingMoveFrame === null)
|
|
361
|
+
return;
|
|
362
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
363
|
+
processMove();
|
|
364
|
+
};
|
|
269
365
|
const onEnd = (endEv) => {
|
|
270
366
|
var _a, _b, _c;
|
|
367
|
+
flushPendingMove();
|
|
271
368
|
isDragging = false;
|
|
369
|
+
isTouchDragging = false;
|
|
370
|
+
element.style.willChange = '';
|
|
371
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
272
372
|
removeDocumentDragListeners();
|
|
273
373
|
if (isClicked) {
|
|
274
374
|
if (clone) {
|
|
@@ -374,6 +474,15 @@ export function enableDraggingWithScaling(element) {
|
|
|
374
474
|
};
|
|
375
475
|
const cleanup = () => {
|
|
376
476
|
isDragging = false;
|
|
477
|
+
isTouchDragging = false;
|
|
478
|
+
element.style.willChange = '';
|
|
479
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
480
|
+
if (pendingMoveFrame !== null) {
|
|
481
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
482
|
+
pendingMoveFrame = null;
|
|
483
|
+
}
|
|
484
|
+
hasPendingMove = false;
|
|
485
|
+
touchTransformUpdated = false;
|
|
377
486
|
observer.disconnect();
|
|
378
487
|
removeDocumentDragListeners();
|
|
379
488
|
element.removeEventListener('mousedown', onStart);
|
|
@@ -861,14 +970,14 @@ export async function onClickDropOrDragElement(element, type) {
|
|
|
861
970
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
862
971
|
const style = document.createElement('style');
|
|
863
972
|
style.id = 'dynamic-highlight-style';
|
|
864
|
-
style.innerHTML = `
|
|
865
|
-
.highlight {
|
|
866
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
867
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
868
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
869
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
870
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
871
|
-
}
|
|
973
|
+
style.innerHTML = `
|
|
974
|
+
.highlight {
|
|
975
|
+
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
976
|
+
// border-radius: 12px; /* Larger rounded corners */
|
|
977
|
+
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
978
|
+
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
979
|
+
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
980
|
+
}
|
|
872
981
|
`;
|
|
873
982
|
document.head.appendChild(style);
|
|
874
983
|
}
|
|
@@ -8,32 +8,32 @@ export function showWrongAnswerAnimation(elements) {
|
|
|
8
8
|
if (!document.querySelector(styleId)) {
|
|
9
9
|
const style = document.createElement('style');
|
|
10
10
|
style.id = styleId;
|
|
11
|
-
style.innerHTML = `
|
|
12
|
-
@keyframes enhanced-shake {
|
|
13
|
-
0% { left: 0; }
|
|
14
|
-
10% { left: -8px; }
|
|
15
|
-
20% { left: 8px; }
|
|
16
|
-
30% { left: -8px; }
|
|
17
|
-
40% { left: 8px; }
|
|
18
|
-
50% { left: -6px; }
|
|
19
|
-
60% { left: 6px; }
|
|
20
|
-
70% { left: -4px; }
|
|
21
|
-
80% { left: 4px; }
|
|
22
|
-
90% { left: -2px; }
|
|
23
|
-
100% { left: 0; }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.wrong-answer {
|
|
28
|
-
position: relative; /* Enable relative positioning to move the element */
|
|
29
|
-
animation: enhanced-shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
|
|
30
|
-
background-color: #ffdddd; /* Flash red background to indicate wrong answer */
|
|
31
|
-
box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); /* Subtle red shadow */
|
|
32
|
-
|
|
33
|
-
border: 4px solid red;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
style.innerHTML = `
|
|
12
|
+
@keyframes enhanced-shake {
|
|
13
|
+
0% { left: 0; }
|
|
14
|
+
10% { left: -8px; }
|
|
15
|
+
20% { left: 8px; }
|
|
16
|
+
30% { left: -8px; }
|
|
17
|
+
40% { left: 8px; }
|
|
18
|
+
50% { left: -6px; }
|
|
19
|
+
60% { left: 6px; }
|
|
20
|
+
70% { left: -4px; }
|
|
21
|
+
80% { left: 4px; }
|
|
22
|
+
90% { left: -2px; }
|
|
23
|
+
100% { left: 0; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
.wrong-answer {
|
|
28
|
+
position: relative; /* Enable relative positioning to move the element */
|
|
29
|
+
animation: enhanced-shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
|
|
30
|
+
background-color: #ffdddd; /* Flash red background to indicate wrong answer */
|
|
31
|
+
box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); /* Subtle red shadow */
|
|
32
|
+
|
|
33
|
+
border: 4px solid red;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
37
|
`;
|
|
38
38
|
document.head.appendChild(style);
|
|
39
39
|
}
|
|
@@ -61,34 +61,34 @@ export function highlightSpeakingElement(element) {
|
|
|
61
61
|
if (!document.getElementById(styleId)) {
|
|
62
62
|
const style = document.createElement('style');
|
|
63
63
|
style.id = styleId;
|
|
64
|
-
style.innerHTML = `
|
|
65
|
-
.speaking-highlight {
|
|
66
|
-
--base-transform: ${element.style.transform};
|
|
67
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
68
|
-
// border: 3px solid green !important;
|
|
69
|
-
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
70
|
-
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
71
|
-
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@keyframes pulseEffect {
|
|
76
|
-
0% {
|
|
77
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
78
|
-
// transform: var(--base-transform) scale(1.05);
|
|
79
|
-
// background-color: #FFFF0B;
|
|
80
|
-
}
|
|
81
|
-
50% {
|
|
82
|
-
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
83
|
-
// transform: var(--base-transform) scale(1.1);
|
|
84
|
-
// background-color: #FFFF0B;
|
|
85
|
-
}
|
|
86
|
-
100% {
|
|
87
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
88
|
-
// transform: var(--base-transform) scale(1.05);
|
|
89
|
-
// background-color: #FFFF0B;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
64
|
+
style.innerHTML = `
|
|
65
|
+
.speaking-highlight {
|
|
66
|
+
--base-transform: ${element.style.transform};
|
|
67
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
68
|
+
// border: 3px solid green !important;
|
|
69
|
+
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
70
|
+
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
71
|
+
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@keyframes pulseEffect {
|
|
76
|
+
0% {
|
|
77
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
78
|
+
// transform: var(--base-transform) scale(1.05);
|
|
79
|
+
// background-color: #FFFF0B;
|
|
80
|
+
}
|
|
81
|
+
50% {
|
|
82
|
+
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
83
|
+
// transform: var(--base-transform) scale(1.1);
|
|
84
|
+
// background-color: #FFFF0B;
|
|
85
|
+
}
|
|
86
|
+
100% {
|
|
87
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
88
|
+
// transform: var(--base-transform) scale(1.05);
|
|
89
|
+
// background-color: #FFFF0B;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
92
|
`;
|
|
93
93
|
document.head.appendChild(style);
|
|
94
94
|
}
|
|
@@ -105,10 +105,10 @@ export function stopHighlightForSpeakingElement(element) {
|
|
|
105
105
|
}
|
|
106
106
|
export function highlightElement() {
|
|
107
107
|
const container = document.querySelector(LidoContainer);
|
|
108
|
-
if (container.getAttribute("template-id") === "blender")
|
|
109
|
-
return;
|
|
110
108
|
if (!container)
|
|
111
109
|
return;
|
|
110
|
+
if (container.getAttribute("template-id") === "blender")
|
|
111
|
+
return;
|
|
112
112
|
const dropElements = buildDropHasDragFromDOM();
|
|
113
113
|
const dropEls = container.querySelectorAll(`[type="drop"]`);
|
|
114
114
|
dropEls.forEach(dropEl => {
|
|
@@ -21,6 +21,20 @@ const slideNumbers = (element) => {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
|
24
|
+
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
25
|
+
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
26
|
+
export const getSlideValuesForValidation = (container, slideElements) => {
|
|
27
|
+
if (isReorderContainer(container)) {
|
|
28
|
+
return slideElements.map(element => element.id);
|
|
29
|
+
}
|
|
30
|
+
return slideElements.map(element => element['value']);
|
|
31
|
+
};
|
|
32
|
+
const syncSlideOrder = (container) => {
|
|
33
|
+
const slideElements = Array.from(container.querySelectorAll("[type='slide']"));
|
|
34
|
+
const slideOrder = getSlideValuesForValidation(container, slideElements);
|
|
35
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(slideOrder));
|
|
36
|
+
return slideOrder;
|
|
37
|
+
};
|
|
24
38
|
export const slideAnimation = async () => {
|
|
25
39
|
const container = document.getElementById(LidoContainer);
|
|
26
40
|
if (!container)
|
|
@@ -81,6 +95,9 @@ export function slidingWithScaling(element) {
|
|
|
81
95
|
const container = document.getElementById(LidoContainer);
|
|
82
96
|
if (container.getAttribute('canplay') === 'false')
|
|
83
97
|
return;
|
|
98
|
+
// Slide activities can start in the correct order. Keep their initial DOM
|
|
99
|
+
// order available to the Next/check validation before the first swap occurs.
|
|
100
|
+
syncSlideOrder(container);
|
|
84
101
|
let verticalDistance;
|
|
85
102
|
let horizontalDistance;
|
|
86
103
|
const onStart = (event) => {
|
|
@@ -262,14 +279,6 @@ export function slidingWithScaling(element) {
|
|
|
262
279
|
element.addEventListener('touchstart', onStart);
|
|
263
280
|
element.addEventListener(LIDO_INTERACTION_CLEANUP_EVENT, cleanup);
|
|
264
281
|
}
|
|
265
|
-
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
266
|
-
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
267
|
-
export const getSlideValuesForValidation = (container, slideElements) => {
|
|
268
|
-
if (isReorderContainer(container)) {
|
|
269
|
-
return slideElements.map(element => element.id);
|
|
270
|
-
}
|
|
271
|
-
return slideElements.map(element => element['value']);
|
|
272
|
-
};
|
|
273
282
|
export const updateArrangeLettersCorrectness = (container, slideValues, objectiveValues) => {
|
|
274
283
|
const slideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
275
284
|
slideElements.forEach((element, index) => {
|
|
@@ -163,11 +163,11 @@ export function enableReorderDrag(element) {
|
|
|
163
163
|
onDropToCategory(element, category);
|
|
164
164
|
}
|
|
165
165
|
if (divEl) {
|
|
166
|
-
const keyframes = `
|
|
167
|
-
@keyframes widthDecrease {
|
|
168
|
-
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
169
|
-
100% { width: 0px; height: 0px;}
|
|
170
|
-
}
|
|
166
|
+
const keyframes = `
|
|
167
|
+
@keyframes widthDecrease {
|
|
168
|
+
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
169
|
+
100% { width: 0px; height: 0px;}
|
|
170
|
+
}
|
|
171
171
|
`;
|
|
172
172
|
const styleSheet = document.styleSheets[0];
|
|
173
173
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
@@ -390,11 +390,11 @@ function moveWithAnimation(target, overlapped) {
|
|
|
390
390
|
const dummy = createDummyElement(target);
|
|
391
391
|
dummy.style.visibility = 'hidden';
|
|
392
392
|
dummy.setAttribute('type', 'dummy');
|
|
393
|
-
const keyframes = `
|
|
394
|
-
@keyframes widthIncrease {
|
|
395
|
-
0% { width: 0px; height: 0px; }
|
|
396
|
-
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
397
|
-
}
|
|
393
|
+
const keyframes = `
|
|
394
|
+
@keyframes widthIncrease {
|
|
395
|
+
0% { width: 0px; height: 0px; }
|
|
396
|
+
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
397
|
+
}
|
|
398
398
|
`;
|
|
399
399
|
if (!overlapped) {
|
|
400
400
|
const overlapCategory = findMostoverlappedElement(target, 'category');
|