lido-player 0.0.2-beta-21-dev → 0.0.2-beta-23-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-Buln7Iaf.js → decode-BDs2S8om.js} +1 -1
- package/dist/cjs/{index-Bb_TFgTA.js → index-D5olYRJo.js} +274 -89
- package/dist/cjs/{index-DBCFoh1I.js → index-DnaH8sO-.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +190 -46
- package/dist/cjs/lido-player.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.tsx +207 -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 +10 -10
- package/dist/collection/components/container/lido-container.js +8 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +46 -28
- package/dist/collection/components/flashCard/lido-flash-card.js +158 -14
- 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 +9 -6
- 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 -145
- package/dist/collection/components/scale/lido-balance.js +54 -14
- 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 +3 -3
- 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 +9 -12
- package/dist/collection/utils/utils.js +24 -8
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +145 -30
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +58 -1
- 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-BOQDbCrm.js → p-BJiyBHYT.js} +1 -1
- package/dist/components/{p-CTlcpv4a.js → p-BfwUqpXc.js} +1 -1
- package/dist/components/p-BiBt9LGP.js +1 -0
- package/dist/components/{p-CgsPIpg0.js → p-Bw-OC9iR.js} +1 -1
- package/dist/components/{p-B4YAipq-.js → p-CFzvgrMa.js} +1 -1
- package/dist/components/{p-C5WmmkI6.js → p-CPYnt0P-.js} +1 -1
- package/dist/components/{p-CCR42e0i.js → p-ChfVUoX4.js} +1 -1
- package/dist/components/{p-BeRr8u5m.js → p-CwDTdXe5.js} +1 -1
- package/dist/components/{p-CXHPZN3m.js → p-CyGxEcn7.js} +1 -1
- package/dist/components/p-D0cGjo5e.js +1 -0
- package/dist/components/{p-BJMjg5wu.js → p-D2GhaM-T.js} +1 -1
- package/dist/components/{p-BBHM059l.js → p-DDS30M3y.js} +1 -1
- package/dist/components/p-DP6jQ5ML.js +1 -0
- package/dist/components/{p-CljvnHkI.js → p-DZRNZCPt.js} +1 -1
- package/dist/components/p-DbR5sNOj.js +1 -0
- package/dist/components/{p-B8nzzM8c.js → p-DdQ1eqJr.js} +1 -1
- package/dist/components/{p-wF7SBGpr.js → p-Ds-d6wd0.js} +2 -2
- package/dist/components/p-Lg85waqZ.js +1 -0
- package/dist/components/p-leIEepjl.js +1 -0
- package/dist/components/{p-C70ykycD.js → p-useuhkjH.js} +1 -1
- package/dist/esm/{decode-B_VrYFdJ.js → decode-CAwfe7ub.js} +1 -1
- package/dist/esm/{index-mMpK8062.js → index-Dvjbti-h.js} +1 -1
- package/dist/esm/{index-B-VyHxJa.js → index-bo7729YG.js} +274 -89
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +190 -46
- package/dist/esm/lido-player.js +3 -3
- package/dist/esm/loader.js +3 -3
- 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 +207 -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-461a3d23.entry.js +12 -0
- package/dist/lido-player/{p-Cw84dpIR.js → p-D4kAEWCU.js} +1 -1
- package/dist/lido-player/p-Dvjbti-h.js +2 -0
- package/dist/lido-player/p-VRJMO_sg.js +1 -0
- package/dist/lido-player/readme.md +49 -49
- package/dist/types/components/flashCard/lido-flash-card.d.ts +14 -0
- package/dist/types/components/scale/lido-balance.d.ts +5 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/types/json.d.ts +3 -3
- package/dist/types/utils/audioPlayer.d.ts +1 -1
- package/dist/types/utils/utilsHandlers/lidoBalanceHandler.d.ts +10 -0
- package/package.json +74 -74
- package/readme.md +113 -113
- package/dist/components/p-BAfFgI9q.js +0 -1
- package/dist/components/p-BfqihbR6.js +0 -1
- package/dist/components/p-CwIlwnQk.js +0 -1
- package/dist/components/p-DLyacZap.js +0 -1
- package/dist/components/p-DONbWJGn.js +0 -1
- package/dist/components/p-DVTigdH_.js +0 -1
- package/dist/lido-player/p-744dee1c.entry.js +0 -12
- package/dist/lido-player/p-BK926Rl3.js +0 -1
- package/dist/lido-player/p-mMpK8062.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { calculateScale, countPatternWords, buildDragSelectedMapFromDOM, getSortedValuesArrayFromMap, executeActions, handleShowCheck, handlingElementFlexibleWidth, onActivityComplete, storingEachActivityScore } from "../utils";
|
|
2
|
-
import { updateBalanceOnDrop } from "./lidoBalanceHandler";
|
|
2
|
+
import { placeDragOnBalancePlate, updateBalanceOnDrop } from "./lidoBalanceHandler";
|
|
3
3
|
import { AudioPlayer } from "../audioPlayer";
|
|
4
4
|
import { DropLength, SelectedValuesKey, DropMode, DropToAttr, DropTimeAttr, LidoContainer, DropAction, LIDO_INTERACTION_CLEANUP_EVENT } from "../constants";
|
|
5
5
|
import { dispatchElementDropEvent } from "../customEvents";
|
|
@@ -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);
|
|
@@ -447,7 +556,8 @@ export async function handleResetDragElement(dragElement, dropElement, dropHasDr
|
|
|
447
556
|
dragElement.classList.remove('dropped');
|
|
448
557
|
const container = document.getElementById(LidoContainer);
|
|
449
558
|
const cloneArray = container.querySelectorAll(`#${dragElement.id}`);
|
|
450
|
-
const
|
|
559
|
+
const balanceHome = dragElement.__lidoBalanceHome;
|
|
560
|
+
const cloneDragElement = ((balanceHome === null || balanceHome === void 0 ? void 0 : balanceHome.isConnected) ? balanceHome : Array.from(cloneArray).find(item => dragElement !== item && !item.classList.contains('dropped')));
|
|
451
561
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
452
562
|
if (cloneDragElement) {
|
|
453
563
|
animateDragToTarget(dragElement, cloneDragElement, container);
|
|
@@ -464,6 +574,7 @@ export async function handleResetDragElement(dragElement, dropElement, dropHasDr
|
|
|
464
574
|
dragElement.style.transform = 'translate(0,0)';
|
|
465
575
|
dragElement.style.position = 'unset';
|
|
466
576
|
cloneDragElement.replaceWith(dragElement);
|
|
577
|
+
delete dragElement.__lidoBalanceHome;
|
|
467
578
|
}, 500);
|
|
468
579
|
}
|
|
469
580
|
else {
|
|
@@ -787,6 +898,10 @@ export async function onElementDropComplete(dragElement, dropElement) {
|
|
|
787
898
|
}
|
|
788
899
|
highlightElement();
|
|
789
900
|
await onActivityComplete(dragElement, dropElement);
|
|
901
|
+
const dropAction = container.getAttribute('drop-action');
|
|
902
|
+
if (container.querySelector('lido-balance') && dropAction !== DropAction.Move && dropAction !== DropAction.InfiniteDrop) {
|
|
903
|
+
placeDragOnBalancePlate(dragElement, dropElement);
|
|
904
|
+
}
|
|
790
905
|
}
|
|
791
906
|
export function updateDropBorder(element) {
|
|
792
907
|
var _a;
|
|
@@ -855,14 +970,14 @@ export async function onClickDropOrDragElement(element, type) {
|
|
|
855
970
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
856
971
|
const style = document.createElement('style');
|
|
857
972
|
style.id = 'dynamic-highlight-style';
|
|
858
|
-
style.innerHTML = `
|
|
859
|
-
.highlight {
|
|
860
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
861
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
862
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
863
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
864
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
865
|
-
}
|
|
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
|
+
}
|
|
866
981
|
`;
|
|
867
982
|
document.head.appendChild(style);
|
|
868
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
|
}
|
|
@@ -1,5 +1,49 @@
|
|
|
1
|
-
import { equationCheck } from "../utils";
|
|
1
|
+
import { calculateScale, equationCheck } from "../utils";
|
|
2
|
+
/**
|
|
3
|
+
* Mount a drag item on a balance plate without using the generic
|
|
4
|
+
* `drop-action="move"` flow. The generic flow creates a new source placeholder
|
|
5
|
+
* for every move, which makes a previously used plate become the item's source.
|
|
6
|
+
*
|
|
7
|
+
* A balance item gets exactly one home placeholder: its original source. It can
|
|
8
|
+
* then move freely between plate parents while continuing to inherit the plate's
|
|
9
|
+
* tilt translation.
|
|
10
|
+
*/
|
|
11
|
+
export function placeDragOnBalancePlate(dragElement, dropElement) {
|
|
12
|
+
var _a;
|
|
13
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
14
|
+
const plateParent = dropElement === null || dropElement === void 0 ? void 0 : dropElement.parentElement;
|
|
15
|
+
if (!balanceEl || !plateParent)
|
|
16
|
+
return;
|
|
17
|
+
const drag = dragElement;
|
|
18
|
+
if (!((_a = drag.__lidoBalanceHome) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
19
|
+
const home = document.createElement('div');
|
|
20
|
+
home.className = 'lido-balance-source-placeholder';
|
|
21
|
+
home.setAttribute('aria-hidden', 'true');
|
|
22
|
+
drag.replaceWith(home);
|
|
23
|
+
drag.__lidoBalanceHome = home;
|
|
24
|
+
}
|
|
25
|
+
// Appending an existing element moves it; it does not leave a second
|
|
26
|
+
// placeholder in the previous plate.
|
|
27
|
+
plateParent.append(drag);
|
|
28
|
+
drag.style.position = 'absolute';
|
|
29
|
+
drag.style.zIndex = '1';
|
|
30
|
+
// The generic drag handler also uses transform. Disable transitions while
|
|
31
|
+
// changing parents and calculating the new local offset so this is one
|
|
32
|
+
// placement, rather than a right/left correction animation.
|
|
33
|
+
drag.style.transition = 'none';
|
|
34
|
+
drag.style.transform = 'translate(0, 0)';
|
|
35
|
+
const dropRect = dropElement.getBoundingClientRect();
|
|
36
|
+
const dragRect = drag.getBoundingClientRect();
|
|
37
|
+
const scale = calculateScale() || 1;
|
|
38
|
+
const x = (dropRect.left + dropRect.width / 2 - (dragRect.left + dragRect.width / 2)) / scale;
|
|
39
|
+
const y = (dropRect.top + dropRect.height / 2 - (dragRect.top + dragRect.height / 2)) / scale;
|
|
40
|
+
drag.style.transform = `translate(${x}px, ${y}px)`;
|
|
41
|
+
requestAnimationFrame(() => {
|
|
42
|
+
drag.style.transition = '';
|
|
43
|
+
});
|
|
44
|
+
}
|
|
2
45
|
export function updateBalanceOnDrop(dragElement, dropElement) {
|
|
46
|
+
var _a, _b;
|
|
3
47
|
const balanceEl = document.querySelector('lido-balance');
|
|
4
48
|
if (!balanceEl)
|
|
5
49
|
return;
|
|
@@ -7,7 +51,20 @@ export function updateBalanceOnDrop(dragElement, dropElement) {
|
|
|
7
51
|
const rightDrag = Array.from(document.querySelectorAll('[drop-to^="righthandle"]'));
|
|
8
52
|
balanceEl.leftVal = calculateValue(leftDrag, balanceEl.operation);
|
|
9
53
|
balanceEl.rightVal = calculateValue(rightDrag, balanceEl.operation);
|
|
54
|
+
const container = document.getElementById('lido-container');
|
|
55
|
+
const objectiveString = (_b = (_a = container === null || container === void 0 ? void 0 : container['objective']) !== null && _a !== void 0 ? _a : container === null || container === void 0 ? void 0 : container.getAttribute('objective')) !== null && _b !== void 0 ? _b : '';
|
|
56
|
+
const isCorrect = !!container && balanceResult(container, objectiveString);
|
|
57
|
+
const dropElements = container ? Array.from(container.querySelectorAll('[type="drop"]')) : [];
|
|
58
|
+
const filledDropCount = dropElements.filter(drop => !!(container === null || container === void 0 ? void 0 : container.querySelector(`[drop-to="${drop.id}"]`))).length;
|
|
59
|
+
const allDropsFilled = dropElements.length > 0 && filledDropCount === dropElements.length;
|
|
60
|
+
if (balanceEl.setFeedbackColor) {
|
|
61
|
+
balanceEl.setFeedbackColor(allDropsFilled && isCorrect ? '#81C127' : allDropsFilled ? '#FF0410' : '');
|
|
62
|
+
}
|
|
10
63
|
if (balanceEl.updateTilt) {
|
|
64
|
+
if (!isCorrect) {
|
|
65
|
+
balanceEl.updateTilt(0, 0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
11
68
|
balanceEl.updateTilt(balanceEl.leftVal, balanceEl.rightVal);
|
|
12
69
|
}
|
|
13
70
|
}
|
|
@@ -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');
|