lido-player 0.0.2-alpha-49 → 0.0.2-alpha-43-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/dist/cjs/{index-fe562525.js → index-6a69c33a.js} +36 -3
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{lido-avatar_19.cjs.entry.js → lido-avatar_21.cjs.entry.js} +431 -180
- package/dist/cjs/lido-player.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-96ce5641.js → utils-079a5e7d.js} +1032 -165
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/calculator/lido-calculator.css +87 -0
- package/dist/collection/components/calculator/lido-calculator.js +321 -0
- package/dist/collection/components/cell/lido-cell.js +1 -1
- package/dist/collection/components/column/lido-col.js +1 -1
- package/dist/collection/components/container/lido-container.js +20 -1
- package/dist/collection/components/flashCard/lido-flash-card.js +1 -1
- package/dist/collection/components/float/lido-float.js +1 -1
- package/dist/collection/components/home/lido-home.js +9 -29
- package/dist/collection/components/keyboard/lido-keyboard.js +2 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +10 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +226 -20
- package/dist/collection/components/position/lido-pos.js +1 -1
- package/dist/collection/components/random/lido-random.js +1 -1
- package/dist/collection/components/row/lido-row.js +1 -1
- package/dist/collection/components/scale/lido-balance.css +114 -0
- package/dist/collection/components/scale/lido-balance.js +549 -0
- package/dist/collection/components/shape/lido-shape.js +1 -1
- package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
- package/dist/collection/components/text/lido-text.js +1 -1
- package/dist/collection/components/trace/lido-trace.js +49 -128
- package/dist/collection/components/wrap/lido-wrap.js +1 -1
- package/dist/collection/css/animation.css +21 -0
- package/dist/collection/css/index.css +45 -0
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +24 -25
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +0 -3
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +67 -0
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +156 -0
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +49 -0
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +66 -0
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +65 -0
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +105 -0
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +92 -0
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +47 -0
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +59 -0
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +93 -0
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +100 -0
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +212 -0
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +6 -7
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +6 -7
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +158 -0
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +102 -0
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +94 -0
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +184 -0
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +213 -0
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +109 -0
- package/dist/collection/stories/Templates/total/total.stories.js +59 -0
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +96 -0
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +55 -0
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +5 -6
- package/dist/collection/utils/utils.js +439 -81
- package/dist/collection/utils/utilsHandlers/clickHandler.js +21 -25
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +95 -42
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +67 -0
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +94 -0
- package/dist/collection/utils/utilsHandlers/matrixHandler.js +298 -0
- package/dist/collection/utils/utilsHandlers/slideHandler.js +4 -2
- package/dist/collection/utils/utilsHandlers/sortHandler.js +21 -12
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.d.ts +11 -0
- package/dist/components/lido-balance.js +6 -0
- package/dist/components/lido-calculator.d.ts +11 -0
- package/dist/components/lido-calculator.js +6 -0
- 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-image.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 +32 -20
- 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-08d0deab.js +254 -0
- package/dist/components/{p-b5b6ad27.js → p-15971ede.js} +1 -1
- package/dist/components/{p-0bf92c7f.js → p-1fbdb431.js} +2 -2
- package/dist/components/{p-b43ce4e1.js → p-29bdd953.js} +2 -2
- package/dist/components/{p-b8af26e6.js → p-322acda6.js} +40 -48
- package/dist/components/{p-51943db6.js → p-3f406017.js} +2 -2
- package/dist/components/p-44808985.js +186 -0
- package/dist/components/{p-4cabbf28.js → p-52844fa4.js} +2 -2
- package/dist/components/{p-4882df37.js → p-73e31a86.js} +2 -2
- package/dist/components/{p-af54a485.js → p-74849cdd.js} +4 -4
- package/dist/components/{p-9c56f378.js → p-7f7e5672.js} +2 -2
- package/dist/components/{p-4dbae73b.js → p-835b973d.js} +2 -2
- package/dist/components/{p-b55af747.js → p-90465904.js} +50 -129
- package/dist/components/{p-cae021c6.js → p-904711c8.js} +2 -2
- package/dist/components/{p-e735dce9.js → p-9be56729.js} +5 -3
- package/dist/components/{p-cac6c8bf.js → p-afbc196f.js} +2 -2
- package/dist/components/{p-cfa2aec8.js → p-bed94c37.js} +1047 -164
- package/dist/components/{p-7f11a624.js → p-cbac3cbc.js} +1 -1
- package/dist/components/{p-61d97438.js → p-d37ab4dc.js} +2 -2
- package/dist/components/p-e36ddcc1.js +166 -0
- package/dist/components/{p-03e4cafe.js → p-e4e42677.js} +2 -2
- package/dist/esm/{index-f47852d4.js → index-170e58c7.js} +36 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/{lido-avatar_19.entry.js → lido-avatar_21.entry.js} +430 -181
- package/dist/esm/lido-player.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-9ce243d8.js → utils-5df09162.js} +1031 -164
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.css +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-137c99ce.js +2 -0
- package/dist/lido-player/p-7556e652.js +9 -0
- package/dist/lido-player/p-eb956325.entry.js +1 -0
- package/dist/types/components/calculator/lido-calculator.d.ts +40 -0
- package/dist/types/components/container/lido-container.d.ts +4 -0
- package/dist/types/components/home/lido-home.d.ts +0 -1
- package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +24 -4
- package/dist/types/components/scale/lido-balance.d.ts +160 -0
- package/dist/types/components/trace/lido-trace.d.ts +0 -1
- package/dist/types/components.d.ts +342 -14
- package/dist/types/stories/Templates/balancing/balancing.stories.d.ts +4 -0
- package/dist/types/stories/Templates/checker-block/checkerBlock.stories.d.ts +4 -0
- package/dist/types/stories/Templates/checkerBlock/checkerBlock.stories.d.ts +4 -0
- package/dist/types/stories/Templates/fillAnswer/fill-answer.stories.d.ts +4 -0
- package/dist/types/stories/Templates/foodJar/food-jar.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchBox/matchBox.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchBox/matchBox2.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchingCard/matching-card.stories.d.ts +4 -0
- package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +9 -0
- package/dist/types/stories/Templates/nimbleTable/nimbleTable.stories.d.ts +4 -0
- package/dist/types/stories/Templates/numberBoardTwo/numberBoardTwo.stories.d.ts +4 -0
- package/dist/types/stories/Templates/numberPair/numberPair.stories.d.ts +4 -0
- package/dist/types/stories/Templates/questionBoard/questionBoard.stories.d.ts +15 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox1.stories.d.ts +11 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox2.stories.d.ts +11 -0
- package/dist/types/stories/Templates/shapePair/shape-pair.stories.d.ts +4 -0
- package/dist/types/stories/Templates/shapeTractor/shape-tractor.stories.d.ts +12 -0
- package/dist/types/stories/Templates/sumTogether/sumTogether.stories.d.ts +11 -0
- package/dist/types/stories/Templates/total/total.stories.d.ts +4 -0
- package/dist/types/stories/Templates/writeNumber/writeNumber.stories.d.ts +13 -0
- package/dist/types/stories/Templates/writeSet/writeSet.stories.d.ts +4 -0
- package/dist/types/utils/utils.d.ts +8 -2
- package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +4 -0
- package/dist/types/utils/utilsHandlers/lidoBalanceHandler.d.ts +2 -0
- package/dist/types/utils/utilsHandlers/lidoCalculatorHandler.d.ts +1 -0
- package/dist/types/utils/utilsHandlers/matrixHandler.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-a8ab771b.js +0 -160
- package/dist/lido-player/p-90212aa9.js +0 -9
- package/dist/lido-player/p-d3911ee1.entry.js +0 -1
- package/dist/lido-player/p-ddf627b0.js +0 -2
|
@@ -33,7 +33,6 @@ export class LidoTrace {
|
|
|
33
33
|
this.fileIndex = -1;
|
|
34
34
|
this.isDragging = false;
|
|
35
35
|
this.activePointerId = null;
|
|
36
|
-
this.freeTraceUpdateCounter = 0;
|
|
37
36
|
this.idleTimer = null;
|
|
38
37
|
this.fingerImg = null;
|
|
39
38
|
}
|
|
@@ -50,8 +49,8 @@ export class LidoTrace {
|
|
|
50
49
|
circle: null,
|
|
51
50
|
paths: [],
|
|
52
51
|
svg: null,
|
|
53
|
-
proximityThreshold:
|
|
54
|
-
freeTraceProximityThreshold:
|
|
52
|
+
proximityThreshold: 100, // General proximity threshold
|
|
53
|
+
freeTraceProximityThreshold: 50, // Reduced proximity threshold for free trace
|
|
55
54
|
rafId: null,
|
|
56
55
|
pointerMoveEvent: null,
|
|
57
56
|
activePointerId: null,
|
|
@@ -387,7 +386,7 @@ export class LidoTrace {
|
|
|
387
386
|
}
|
|
388
387
|
// Modified handlePointerMove function
|
|
389
388
|
handlePointerMove(state) {
|
|
390
|
-
var _a, _b, _c, _d
|
|
389
|
+
var _a, _b, _c, _d;
|
|
391
390
|
if (!state.isDragging)
|
|
392
391
|
return;
|
|
393
392
|
if (!state.circle || !state.paths || state.paths.length === 0)
|
|
@@ -399,15 +398,6 @@ export class LidoTrace {
|
|
|
399
398
|
x: parseFloat(state.circle.getAttribute('cx')),
|
|
400
399
|
y: parseFloat(state.circle.getAttribute('cy')),
|
|
401
400
|
};
|
|
402
|
-
// Only update if pointer moved a minimum distance (to reduce unnecessary updates)
|
|
403
|
-
const MOVE_THRESHOLD = 1; // px
|
|
404
|
-
if (state.lastPointerPos) {
|
|
405
|
-
const dx = pointerPos.x - state.lastPointerPos.x;
|
|
406
|
-
const dy = pointerPos.y - state.lastPointerPos.y;
|
|
407
|
-
if (dx * dx + dy * dy < MOVE_THRESHOLD * MOVE_THRESHOLD) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
401
|
const currentPath = state.paths[state.currentPathIndex];
|
|
412
402
|
if (!currentPath) {
|
|
413
403
|
console.error('No valid path found at the current index');
|
|
@@ -435,76 +425,48 @@ export class LidoTrace {
|
|
|
435
425
|
}
|
|
436
426
|
// For free trace mode and blind free trace mode, allow free drawing only if within the reduced proximity threshold
|
|
437
427
|
if (state.mode === TraceMode.FreeTrace || state.mode === TraceMode.BlindFreeTrace) {
|
|
438
|
-
// Throttle: Only update every 2nd event (for reducing excessive dom updates)
|
|
439
|
-
this.freeTraceUpdateCounter = (this.freeTraceUpdateCounter || 0) + 1;
|
|
440
|
-
if (this.freeTraceUpdateCounter % 2 !== 0) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
428
|
// Initialize the currentFreePath array if it's not created
|
|
444
429
|
if (!state.currentFreePath) {
|
|
445
430
|
state.currentFreePath = [];
|
|
446
431
|
}
|
|
447
|
-
// Create a new
|
|
432
|
+
// Create a new path element if it's the first trace for the current path index
|
|
448
433
|
if (!state.currentFreePath[state.currentPathIndex]) {
|
|
449
|
-
const
|
|
434
|
+
const newPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
435
|
+
// newPath.setAttribute('stroke', 'green');
|
|
450
436
|
const strokeWidth = state.paths[state.currentPathIndex].style['stroke-width'] || state.paths[state.currentPathIndex].getAttribute('stroke-width');
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
(
|
|
457
|
-
state.
|
|
458
|
-
|
|
459
|
-
state.currentFreePolylinePoints = state.currentFreePolylinePoints || [];
|
|
460
|
-
state.currentFreePolylinePoints[state.currentPathIndex] = [
|
|
461
|
-
{ x: pointerPos.x, y: pointerPos.y }
|
|
462
|
-
];
|
|
437
|
+
newPath.setAttribute('stroke-width', strokeWidth);
|
|
438
|
+
newPath.setAttribute('fill', 'none');
|
|
439
|
+
newPath.setAttribute('stroke-linecap', 'round');
|
|
440
|
+
newPath.setAttribute('stroke', 'lightgreen');
|
|
441
|
+
// Start the new path at the current pointer position
|
|
442
|
+
newPath.setAttribute('d', `M${pointerPos.x},${pointerPos.y}`);
|
|
443
|
+
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.appendChild(newPath);
|
|
444
|
+
state.currentFreePath[state.currentPathIndex] = newPath;
|
|
463
445
|
// Reset lastPointerPos for the new path
|
|
464
446
|
state.lastPointerPos = pointerPos;
|
|
465
|
-
// Add a points counter to limit path growth
|
|
466
|
-
state.freeTracePointsCount = 1;
|
|
467
447
|
}
|
|
468
|
-
//
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
//
|
|
476
|
-
state.
|
|
477
|
-
let pointsArr = state.currentFreePolylinePoints[state.currentPathIndex] || [];
|
|
478
|
-
pointsArr.push({ x: pointerPos.x, y: pointerPos.y });
|
|
479
|
-
state.currentFreePolylinePoints[state.currentPathIndex] = pointsArr;
|
|
480
|
-
// Update the polyline's points attribute
|
|
481
|
-
const pointsStr = pointsArr.map(pt => `${pt.x},${pt.y}`).join(' ');
|
|
482
|
-
state.currentFreePath[state.currentPathIndex].setAttribute('points', pointsStr);
|
|
448
|
+
// Get the previous position to draw a smooth curve
|
|
449
|
+
const previousPos = state.lastPointerPos || pointerPos;
|
|
450
|
+
// Create a quadratic curve from the previous point to the current point
|
|
451
|
+
const newPathData = state.currentFreePath[state.currentPathIndex].getAttribute('d');
|
|
452
|
+
const midPointX = (previousPos.x + pointerPos.x) / 2;
|
|
453
|
+
const midPointY = (previousPos.y + pointerPos.y) / 2;
|
|
454
|
+
const updatedPathData = `${newPathData} Q ${previousPos.x},${previousPos.y} ${midPointX},${midPointY}`;
|
|
455
|
+
// Update the path's 'd' attribute with the new curve
|
|
456
|
+
state.currentFreePath[state.currentPathIndex].setAttribute('d', updatedPathData);
|
|
483
457
|
// Move the draggable circle with the freehand trace
|
|
484
458
|
state.circle.setAttribute('cx', pointerPos.x.toString());
|
|
485
459
|
state.circle.setAttribute('cy', pointerPos.y.toString());
|
|
486
|
-
//
|
|
487
|
-
|
|
488
|
-
let circleFound = false;
|
|
489
|
-
for (let i = 0; i < ((childNodes === null || childNodes === void 0 ? void 0 : childNodes.length) || 0); i++) {
|
|
490
|
-
const child = childNodes === null || childNodes === void 0 ? void 0 : childNodes.item(i);
|
|
491
|
-
if (child && child.tagName === 'circle') {
|
|
492
|
-
circleFound = true;
|
|
493
|
-
break; // No need to continue once found
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
// If not found, append the circle
|
|
497
|
-
if (!circleFound && state.circle) {
|
|
498
|
-
(_c = state.svg) === null || _c === void 0 ? void 0 : _c.appendChild(state.circle);
|
|
499
|
-
}
|
|
460
|
+
// Make sure the red dot (circle) is always on top
|
|
461
|
+
(_b = state.svg) === null || _b === void 0 ? void 0 : _b.appendChild(state.circle); // This moves the circle to the last child, making it the topmost
|
|
500
462
|
// Update the last pointer position
|
|
501
463
|
state.lastPointerPos = pointerPos;
|
|
502
|
-
|
|
503
|
-
|
|
464
|
+
const currentPathLength = currentPath.getTotalLength();
|
|
465
|
+
const distanceToEnd = currentPathLength - closestPoint.length;
|
|
466
|
+
// If close to the end of the path, move to the next path
|
|
467
|
+
if (distanceToEnd < 5) {
|
|
504
468
|
this.moveToNextPath(state);
|
|
505
469
|
state.currentFreePath[state.currentPathIndex] = null; // Reset free path for next path
|
|
506
|
-
state.currentFreePolylinePoints[state.currentPathIndex] = [];
|
|
507
|
-
state.freeTracePointsCount = 0;
|
|
508
470
|
}
|
|
509
471
|
// this.resetIdleTimer(state); // ← keep timer alive
|
|
510
472
|
return; // Exit early since we're in free trace or blind free trace mode
|
|
@@ -512,62 +474,24 @@ export class LidoTrace {
|
|
|
512
474
|
// In normal modes, allow movement and drawing only within the general proximity threshold
|
|
513
475
|
if (state.isDragging && closestPoint.length >= state.lastLength) {
|
|
514
476
|
state.lastLength = closestPoint.length;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
// If not found, append the circle
|
|
531
|
-
if (!circleFound && state.circle) {
|
|
532
|
-
(_e = state.svg) === null || _e === void 0 ? void 0 : _e.appendChild(state.circle);
|
|
533
|
-
}
|
|
534
|
-
(_f = currentPath.greenPath) === null || _f === void 0 ? void 0 : _f.setAttribute('stroke-dashoffset', (state.totalPathLength - state.lastLength).toString());
|
|
535
|
-
// Completion logic for closed paths: only allow completion if almost all points are traced
|
|
536
|
-
const COMPLETION_THRESHOLD = 0.90; // 90% of the path must be traced
|
|
537
|
-
let percentComplete = state.lastLength / state.totalPathLength;
|
|
538
|
-
let startPoint = currentPath.getPointAtLength(0);
|
|
539
|
-
let endPoint = currentPath.getPointAtLength(currentPath.getTotalLength());
|
|
540
|
-
let pathIsClosed = this.getDistanceSquared(startPoint, endPoint) < 200; // threshold for overlap
|
|
541
|
-
console.log('lastLength, totalPathLength', state.lastLength, state.totalPathLength);
|
|
542
|
-
console.log('percentComplete', percentComplete);
|
|
543
|
-
console.log('startPoint, endPoint', startPoint, endPoint);
|
|
544
|
-
console.log('distance squared between start & end:', this.getDistanceSquared(startPoint, endPoint));
|
|
545
|
-
console.log('pathIsClosed:', pathIsClosed);
|
|
546
|
-
if (pathIsClosed && state.totalPathLength > 50) {
|
|
547
|
-
if (percentComplete >= COMPLETION_THRESHOLD) {
|
|
548
|
-
if (state.currentPathIndex < state.paths.length - 1) {
|
|
549
|
-
this.moveToNextPath(state);
|
|
550
|
-
}
|
|
551
|
-
else if (state.currentPathIndex === state.paths.length - 1) {
|
|
552
|
-
this.moveToNextContainer();
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
// For open paths, allow completion if near the end
|
|
558
|
-
if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex < state.paths.length - 1) {
|
|
559
|
-
this.moveToNextPath(state);
|
|
560
|
-
}
|
|
561
|
-
else if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex === state.paths.length - 1) {
|
|
562
|
-
this.moveToNextContainer();
|
|
563
|
-
}
|
|
564
|
-
}
|
|
477
|
+
state.circle.setAttribute('cx', closestPoint.x.toString());
|
|
478
|
+
state.circle.setAttribute('cy', closestPoint.y.toString());
|
|
479
|
+
// Make sure the red dot (circle) is always on top
|
|
480
|
+
(_c = state.svg) === null || _c === void 0 ? void 0 : _c.appendChild(state.circle); // This moves the circle to the last child, making it the topmost
|
|
481
|
+
(_d = currentPath.greenPath) === null || _d === void 0 ? void 0 : _d.setAttribute('stroke-dashoffset', (state.totalPathLength - state.lastLength).toString());
|
|
482
|
+
}
|
|
483
|
+
// Check if the current path is completed
|
|
484
|
+
if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex < state.paths.length - 1) {
|
|
485
|
+
this.moveToNextPath(state);
|
|
486
|
+
}
|
|
487
|
+
else if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex === state.paths.length - 1) {
|
|
488
|
+
// this.loadAnotherSVG(state, true);
|
|
489
|
+
this.moveToNextContainer();
|
|
565
490
|
}
|
|
566
491
|
// this.resetIdleTimer(state); // ← keep timer alive
|
|
567
492
|
}
|
|
568
493
|
// Move to the next container after completing the current SVG
|
|
569
494
|
async moveToNextContainer() {
|
|
570
|
-
this.isDragging = false;
|
|
571
495
|
if (this.moving)
|
|
572
496
|
return; // Prevent multiple calls
|
|
573
497
|
this.moving = true; // Set moving to true to prevent re-entrance
|
|
@@ -578,19 +502,17 @@ export class LidoTrace {
|
|
|
578
502
|
await this.playTraceAnimation();
|
|
579
503
|
}
|
|
580
504
|
console.log(`Moving to next container after SVG index: ${this.currentSvgIndex}`);
|
|
581
|
-
|
|
505
|
+
const delay = 1000; // milliseconds
|
|
582
506
|
if (this.currentSvgIndex < this.svgUrls.length - 1) {
|
|
507
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
583
508
|
this.currentSvgIndex++;
|
|
584
509
|
await this.initializeSVG();
|
|
585
510
|
this.moving = false;
|
|
586
511
|
return;
|
|
587
512
|
}
|
|
588
|
-
console.log('onCorrect:', this.onCorrect);
|
|
589
|
-
console.log('el :', this.el);
|
|
590
513
|
if (this.el && this.onCorrect) {
|
|
591
514
|
await executeActions(this.onCorrect, this.el);
|
|
592
515
|
}
|
|
593
|
-
console.log('All SVGs completed, hiding component.');
|
|
594
516
|
triggerNextContainer();
|
|
595
517
|
}
|
|
596
518
|
// Get the pointer position relative to the SVG
|
|
@@ -608,13 +530,13 @@ export class LidoTrace {
|
|
|
608
530
|
const dy = p1.y - p2.y;
|
|
609
531
|
return dx * dx + dy * dy;
|
|
610
532
|
}
|
|
611
|
-
// Find the closest point on the given path to the specified point using two-pass sampling
|
|
533
|
+
// Find the closest point on the given path to the specified point using two-pass sampling
|
|
612
534
|
getClosestPointOnPath(pathNode, point) {
|
|
613
535
|
const pathLength = pathNode.getTotalLength();
|
|
614
536
|
let closestPoint = { x: 0, y: 0, length: 0 };
|
|
615
537
|
let minDistanceSquared = Infinity;
|
|
616
|
-
//
|
|
617
|
-
const coarseStep =
|
|
538
|
+
// First pass: coarse sampling
|
|
539
|
+
const coarseStep = 20; // Increased step for better performance
|
|
618
540
|
let coarseClosestPoint = { x: 0, y: 0, length: 0 };
|
|
619
541
|
let coarseMinDistanceSquared = Infinity;
|
|
620
542
|
for (let i = 0; i <= pathLength; i += coarseStep) {
|
|
@@ -630,7 +552,7 @@ export class LidoTrace {
|
|
|
630
552
|
}
|
|
631
553
|
}
|
|
632
554
|
// Second pass: fine sampling around coarseClosestPoint
|
|
633
|
-
const fineStep =
|
|
555
|
+
const fineStep = 2; // Increased step to reduce computations
|
|
634
556
|
const searchStart = Math.max(coarseClosestPoint.length - coarseStep, 0);
|
|
635
557
|
const searchEnd = Math.min(coarseClosestPoint.length + coarseStep, pathLength);
|
|
636
558
|
for (let i = searchStart; i <= searchEnd; i += fineStep) {
|
|
@@ -790,7 +712,7 @@ export class LidoTrace {
|
|
|
790
712
|
};
|
|
791
713
|
}
|
|
792
714
|
render() {
|
|
793
|
-
return (h(Host, { key: '
|
|
715
|
+
return (h(Host, { key: '6be6d97477a80afc0275eef5b17718a5f43ce358', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, h("div", { key: '4e650d7142c61549aec021fd2a8da4e592eaf94e', style: this.style, id: "lido-svgContainer" })));
|
|
794
716
|
}
|
|
795
717
|
static get is() { return "lido-trace"; }
|
|
796
718
|
static get originalStyleUrls() {
|
|
@@ -1194,7 +1116,6 @@ export class LidoTrace {
|
|
|
1194
1116
|
"fileIndex": {},
|
|
1195
1117
|
"isDragging": {},
|
|
1196
1118
|
"activePointerId": {},
|
|
1197
|
-
"freeTraceUpdateCounter": {},
|
|
1198
1119
|
"idleTimer": {},
|
|
1199
1120
|
"fingerImg": {}
|
|
1200
1121
|
};
|
|
@@ -80,7 +80,7 @@ export class LidoWrap {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
return (h(Host, { key: '
|
|
83
|
+
return (h(Host, { key: '7e2bb4af31b5aff0f063a9f6c3cab96cdd25f31f', class: "lido-wrap", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, disableSpeak: this.disableSpeak }, h("slot", { key: '03179b28e45692e61aff0bf3634ef0a72bab0726' })));
|
|
84
84
|
}
|
|
85
85
|
static get is() { return "lido-wrap"; }
|
|
86
86
|
static get originalStyleUrls() {
|
|
@@ -171,4 +171,25 @@
|
|
|
171
171
|
50% { transform: translate(-20px, 20px); background-color: rgba(255, 0, 0, 0.3); }
|
|
172
172
|
75% { transform: translate(10px, -10px); background-color: rgba(255, 0, 0, 0.2); }
|
|
173
173
|
100% { transform: translate(0, 0); background-color: transparent; }
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@keyframes glowPulse {
|
|
177
|
+
0% {
|
|
178
|
+
filter: drop-shadow(0 0 5px yellow)
|
|
179
|
+
drop-shadow(0 0 10px yellow)
|
|
180
|
+
drop-shadow(0 0 20px yellow)
|
|
181
|
+
drop-shadow(0 0 30px orange);
|
|
182
|
+
}
|
|
183
|
+
50% {
|
|
184
|
+
filter: drop-shadow(0 0 10px yellow)
|
|
185
|
+
drop-shadow(0 0 20px yellow)
|
|
186
|
+
drop-shadow(0 0 40px yellow)
|
|
187
|
+
drop-shadow(0 0 50px orange);
|
|
188
|
+
}
|
|
189
|
+
100% {
|
|
190
|
+
filter: drop-shadow(0 0 5px yellow)
|
|
191
|
+
drop-shadow(0 0 10px yellow)
|
|
192
|
+
drop-shadow(0 0 20px yellow)
|
|
193
|
+
drop-shadow(0 0 30px orange);
|
|
194
|
+
}
|
|
174
195
|
}
|
|
@@ -231,3 +231,48 @@ body {
|
|
|
231
231
|
will-change: transform;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
.lido-glow {
|
|
235
|
+
animation: glowPulse 1s infinite alternate;
|
|
236
|
+
transition: opacity 0.5s ease-in-out;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.lido-box-highlight {
|
|
240
|
+
animation: topToPlace 0.3s linear;
|
|
241
|
+
}
|
|
242
|
+
.lido-display-hiddenvalue {
|
|
243
|
+
position: absolute;
|
|
244
|
+
top: 0;
|
|
245
|
+
left: 0;
|
|
246
|
+
width: 100%;
|
|
247
|
+
height: 100%;
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
justify-content: center;
|
|
251
|
+
font-size: 80px;
|
|
252
|
+
font-weight: 1000;
|
|
253
|
+
color: brown;
|
|
254
|
+
-webkit-text-stroke: 2px white;
|
|
255
|
+
font-family: 'Baloo Bhai 2', sans-serif;
|
|
256
|
+
pointer-events: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.lido-image-colorize {
|
|
260
|
+
position: relative;
|
|
261
|
+
display: inline-block;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.lido-image-colorize::after {
|
|
265
|
+
content: '';
|
|
266
|
+
position: absolute;
|
|
267
|
+
inset: 0;
|
|
268
|
+
background: var(--tint-color);
|
|
269
|
+
mix-blend-mode: multiply;
|
|
270
|
+
opacity: 0.8;
|
|
271
|
+
pointer-events: none;
|
|
272
|
+
|
|
273
|
+
/* this line ensures tint fits only in visible image area */
|
|
274
|
+
mask-image: var(--mask-url);
|
|
275
|
+
mask-size: cover;
|
|
276
|
+
mask-repeat: no-repeat;
|
|
277
|
+
mask-position: center;
|
|
278
|
+
}
|
|
@@ -83,57 +83,56 @@ function getContainerXml(args) {
|
|
|
83
83
|
return `
|
|
84
84
|
<main>
|
|
85
85
|
<lido-container id="lido-container" is-allow-only-correct="true" value="mainContainer1" bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/fill-in-the-blanks/cloud.png" objective="${args.answer1},${args.answer2},${args.answer3},${args.answer4}" width="100%" bg-color="transparent" visible="true" onCorrect="lido-avatar.avatarAnimate='Success';this.sleep='2000'; " onEntry="this.justifyContent='space-around';" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" show-check="false" is-continue-on-correct="true" after-drop="false">
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<lido-cell layout="pos" id="pos1" disable-edit="true" value="pos2" height="landscape.448px,portrait.402px" width="landscape.350px,portrait.398px" x="landscape.-87px, portrait.541px" y="landscape.350px, portrait.1304px" aria-hidden="true" z="1" bg-color="transparent" visible="true" onEntry="this.animation='leftToPlace 2.5s linear';">
|
|
86
|
+
<!-- Chimple Avatar -->
|
|
87
|
+
<lido-cell layout="pos" id="pos1" disable-edit="true" value="pos2" height="landscape.448px,portrait.402px" width="landscape.350px,portrait.398px" x="landscape.1267px, portrait.541px" y="landscape.587px, portrait.1304px" aria-hidden="true" z="1" bg-color="transparent" visible="true" onEntry="this.animation='rightToPlace 2.5s linear';">
|
|
89
88
|
<lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="100%" width="100%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp2/chimplecharacter.riv" alt-text="{chimpleCharacterRive}">
|
|
90
89
|
</lido-avatar>
|
|
91
90
|
</lido-cell>
|
|
92
91
|
|
|
93
92
|
<!--Parent cell -->
|
|
94
|
-
<lido-cell layout="col" visible="true" width="100%" height="100%" bg-color="transparent"
|
|
93
|
+
<lido-cell layout="col" visible="true" width="100%" height="100%" bg-color="transparent">
|
|
95
94
|
<!-- heading -->
|
|
96
95
|
<lido-cell visible="true" margin="landscape.12px 0px -17px 0px, portrait.0px 0px 0px;">
|
|
97
|
-
<lido-text show-speak-icon="true" id="heading" tab-index="1" width="
|
|
96
|
+
<lido-text show-speak-icon="true" id="heading" tab-index="1" width="354px" visible="true" audio="${args.headingAudio}" string="${args.heading}" font-family="'Baloo Bhai 2'" fontColor="black" font-size="landscape.36px, portrait.40px" bg-color="transparent" onEntry=" this.fontWeight='700';" margin="landscape.32px 0px 4px 0px,portrait.18px 0px 0px 0px">
|
|
98
97
|
</lido-text>
|
|
99
98
|
</lido-cell>
|
|
100
99
|
<!-- fill up based on image -->
|
|
101
100
|
|
|
102
|
-
<lido-cell show-speak-icon="true" audio="${args.sentenceAudio}" layout="landscape.row, portrait.col" visible="true" width="landscape.
|
|
101
|
+
<lido-cell show-speak-icon="true" audio="${args.sentenceAudio}" layout="landscape.row, portrait.col" visible="true" width="landscape.auto, portrait.69%" height="landscape.59%, portrait.auto" bg-color="white" onEntry="this.borderRadius='10px'; this.padding='8px';" margin="landscape.0 , portrait.18px 0px 0px 0px">
|
|
103
102
|
|
|
104
103
|
<!-- image -->
|
|
105
|
-
${args.img.length === 0 ? '' : `<lido-image id="image1" disable-edit="true" visible="true" src="${args.img}" width="landscape.
|
|
104
|
+
${args.img.length === 0 ? '' : `<lido-image id="image1" disable-edit="true" visible="true" src="${args.img}" width="landscape.515px, portrait.100%" height="landscape.100%, portrait.62%" margin="landscape.0px 0px 0px 0px , portrait. 0">
|
|
106
105
|
</lido-image>`}
|
|
107
106
|
<!-- text -->
|
|
108
107
|
|
|
109
108
|
|
|
110
109
|
|
|
111
|
-
<lido-cell layout="flex" bg-Color="transparent" visible="true" height="landscape.100%,portrait.
|
|
110
|
+
<lido-cell layout="flex" bg-Color="transparent" visible="true" height="landscape.100%,portrait.auto" width="landscape.600px, portrait.97%" onEntry="this.align-content='center'; this.gap='32px';this.display='ruby';" margin="landscape.21px 0px 0px 61px, portrait.33px 0px 0px 64px">
|
|
112
111
|
|
|
113
|
-
<lido-text tab-index="2" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
114
|
-
<lido-text tab-index="3" drop-attr="stretch" id="drop1" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer1}" type="drop" is-allow-only-one-drop="true" drop-Attr="stretch" onEntry="this.border-radius='10px';this.box-shoadow='';
|
|
115
|
-
<lido-text tab-index="4" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
116
|
-
<lido-text tab-index="5" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
117
|
-
<lido-text tab-index="6" drop-attr="stretch" id="drop2" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer2}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px';this.margin-top='17px';
|
|
118
|
-
<lido-text tab-index="7" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
119
|
-
<lido-text tab-index="8" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
120
|
-
<lido-text tab-index="9" drop-attr="stretch" id="drop3" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer3}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px';this.margin-top='17px';
|
|
121
|
-
<lido-text tab-index="10" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
122
|
-
<lido-text tab-index="11" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
123
|
-
<lido-text tab-index="12" id="drop4" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer4}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px'; this.
|
|
124
|
-
<lido-text tab-index="13" font-family="'Baloo Bhai 2'" visible="true" font-size="
|
|
112
|
+
<lido-text tab-index="2" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text1}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px'; "></lido-text>
|
|
113
|
+
<lido-text tab-index="3" drop-attr="stretch" id="drop1" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer1}" type="drop" is-allow-only-one-drop="true" drop-Attr="stretch" onEntry="this.border-radius='10px';this.box-shoadow=''; this.margin-right='35px';" ></lido-text>
|
|
114
|
+
<lido-text tab-index="4" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text2}" bg-color="transparent" onEntry="this.position='relative';this.display='inline';this.boxShadow='0 0 0'; this.padding='0px 21px 0px 0px';"></lido-text>
|
|
115
|
+
<lido-text tab-index="5" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text3}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 18px 0px 0px';"></lido-text>
|
|
116
|
+
<lido-text tab-index="6" drop-attr="stretch" id="drop2" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer2}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px';this.margin-top='17px'; " ></lido-text>
|
|
117
|
+
<lido-text tab-index="7" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text4}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px'; "></lido-text>
|
|
118
|
+
<lido-text tab-index="8" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text5}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px'; "></lido-text>
|
|
119
|
+
<lido-text tab-index="9" drop-attr="stretch" id="drop3" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer3}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px';this.margin-top='17px'; "></lido-text>
|
|
120
|
+
<lido-text tab-index="10" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text6}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px';"></lido-text>
|
|
121
|
+
<lido-text tab-index="11" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text7} " bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px'; "></lido-text>
|
|
122
|
+
<lido-text tab-index="12" id="drop4" disable-edit="true" visible="true" width="164px" height="landscape.73px,portrait.77px" value="${args.answer4}" drop-Attr="stretch" type="drop" is-allow-only-one-drop="true" onEntry="this.border-radius='10px'; this.margin-right='35px'; this.margin-top='17px';" ></lido-text>
|
|
123
|
+
<lido-text tab-index="13" font-family="'Baloo Bhai 2'" visible="true" font-size="40px" y="-10px" string="${args.text8}" bg-color="transparent" onEntry="this.position='relative'; this.fontWeight='400';this.display='inline'; this.padding='0px 20px 0px 0px'; "></lido-text>
|
|
125
124
|
|
|
126
125
|
</lido-cell>
|
|
127
126
|
|
|
128
127
|
</lido-cell>
|
|
129
|
-
<lido-cell layout="landscape.row, portrait.wrap" childElementsLength="4" onEntry="this.gap='28px'; this.gridTemplateColumns = 'repeat(2, 1fr)'; this.gridTemplateRows = 'repeat(2, 1fr)';" visible="true" margin="landscape.6px
|
|
130
|
-
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option1Audio}" id="option1" value="${args.option1}" tab-index="14" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='
|
|
128
|
+
<lido-cell layout="landscape.row, portrait.wrap" childElementsLength="4" onEntry="this.gap='28px'; this.gridTemplateColumns = 'repeat(2, 1fr)'; this.gridTemplateRows = 'repeat(2, 1fr)';" visible="true" margin="landscape.6px 383px 74px 0px, portrait.34px 128px 0px -113px">
|
|
129
|
+
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option1Audio}" id="option1" value="${args.option1}" tab-index="14" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='400';" width="auto" height="landscape.87px, portrait.91px" string="${args.option1}" fontColor="black" font-size="40px" type="drag">
|
|
131
130
|
</lido-text>
|
|
132
|
-
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option2Audio}" id="option2" value="${args.option2}" tab-index="15" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='
|
|
131
|
+
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option2Audio}" id="option2" value="${args.option2}" tab-index="15" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='400'; " width="auto" height="landscape.87px, portrait.91px" string="${args.option2}" fontColor="black" font-size="40px" type="drag">
|
|
133
132
|
</lido-text>
|
|
134
|
-
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option3Audio}" id="option3" value="${args.option3}" tab-index="16" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='
|
|
133
|
+
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option3Audio}" id="option3" value="${args.option3}" tab-index="16" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='400'; " width="auto" height="landscape.87px, portrait.91px" string="${args.option3}" fontColor="black" font-size="40px" type="drag">
|
|
135
134
|
</lido-text>
|
|
136
|
-
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option4Audio}" id="option4" value="${args.option4}" tab-index="17" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='
|
|
135
|
+
<lido-text font-family="'Baloo Bhai 2'" audio="${args.option4Audio}" id="option4" value="${args.option4}" tab-index="17" visible="true" bg-color="#fcf3b1" onEntry="this.padding='0px 48px'; this.borderRadius='24px'; this.fontWeight='400';" width="auto" height="landscape.87px, portrait.91px" string="${args.option4}" fontColor="black" font-size="40px" type="drag">
|
|
137
136
|
</lido-text>
|
|
138
137
|
</lido-cell>
|
|
139
138
|
|
|
@@ -97,9 +97,6 @@ function getContainerXml(args) {
|
|
|
97
97
|
<lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="462px" width="356px" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp2/chimplecharacter.riv" alt-text="{chimpleCharacterRive}">
|
|
98
98
|
</lido-avatar>
|
|
99
99
|
</lido-cell>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
100
|
<lido-cell layout="pos" value="pos2" tab-index="3" id="pos2" visible="true" height="landscape.305px, portrait.auto " width="landscape.100%, portrait.100%;" y="landscape.-35%, portrait.-12%" x="landscape.23%, portrait.0%" onEntry="this.background-color='transparent'">
|
|
104
101
|
<lido-image id="board_bg_wordnote" tab-index="4" disable-edit="true" visible="true" src="https://media.githubusercontent.com/media/chimple/bahama/refs/heads/master/assets/games/rocket/textures/board_bg_wordnote.png">
|
|
105
102
|
</lido-image>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Templates/Balancing',
|
|
4
|
+
argTypes: {
|
|
5
|
+
leftValue: { control: 'text' },
|
|
6
|
+
rightValue: { control: 'text' },
|
|
7
|
+
objective: { control: 'text' },
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Balancing = {
|
|
12
|
+
args: {
|
|
13
|
+
leftValue: '10-5',
|
|
14
|
+
rightValue: '11-2',
|
|
15
|
+
objective: '>',
|
|
16
|
+
},
|
|
17
|
+
render: args => {
|
|
18
|
+
const xml = getContainerXml(args);
|
|
19
|
+
return html `<lido-home .xmlData="${xml}"></lido-home>`;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
function escapeXml(str) {
|
|
23
|
+
if (!str)
|
|
24
|
+
return '';
|
|
25
|
+
return str.replace(/&/g, '&')
|
|
26
|
+
.replace(/</g, '<')
|
|
27
|
+
.replace(/>/g, '>')
|
|
28
|
+
.replace(/"/g, '"')
|
|
29
|
+
.replace(/'/g, ''');
|
|
30
|
+
}
|
|
31
|
+
function getContainerXml(args) {
|
|
32
|
+
const objective = escapeXml(args.objective);
|
|
33
|
+
const leftValue = escapeXml(args.leftValue);
|
|
34
|
+
const rightValue = escapeXml(args.rightValue);
|
|
35
|
+
return `
|
|
36
|
+
<main>
|
|
37
|
+
<lido-container visible="true" drop-action="move" objective="${objective}" equationCheck="$#lefthandle1,$#righthandle1" id="lido-container" onCorrect="lido-avatar.avatarAnimate='Success';this.sleep='2000';" show-Check="true" bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/Sky.png" is-continue-on-correct="true">
|
|
38
|
+
<!-- Check Button -->
|
|
39
|
+
<lido-pos id="pos1" disable-edit="true" value="pos1" height="70px" width="150px" x="landscape.1324px,portrait.639px" y="landscape.220px,portrait.28%" aria-hidden="true" z="1" bg-color="transparent" type="" visible="true" audio="col1.mp3" onTouch="" onCorrect="" onEntry="">
|
|
40
|
+
<lido-text id="lido-checkButton" visible="true" bg-color="#5b5bd3" width="150px" height="70px" string="Check" type="click" font-family="'Baloo 2', serif" font-size="30px" font-color="white" onEntry="this.fontWeight='800'; this.addClass='lido-disable-check-button';">
|
|
41
|
+
</lido-text>
|
|
42
|
+
</lido-pos>
|
|
43
|
+
<!-- question -->
|
|
44
|
+
<lido-text visible="true" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.12%,portrait.-4%" onEntry="this.font-weight='600'; this.position='relative';">
|
|
45
|
+
</lido-text>
|
|
46
|
+
<lido-balance tilt="0" operation="add" visible="true" height="landscape.456px,portrait.500px" y="landscape.180px,portrait.6%" width="landscape.1136px,portrait.876px">
|
|
47
|
+
</lido-balance>
|
|
48
|
+
<!-- drop Element -->
|
|
49
|
+
<lido-cell layout="row" visible="true" id="leftparent" heigth="auto" width="auto" bg-Color="transparent" y="landscape.-158px,portrait.-276px" x="landscape.-357px,portrait.-293px" onEntry="this.position='relative';">
|
|
50
|
+
<lido-text visible="true" id="lefthandle1" tab-index="1" value="" height="126px" width="120px" type="drop"></lido-text>
|
|
51
|
+
</lido-cell>
|
|
52
|
+
<lido-cell layout="row" visible="true" id="rightparent" heigth="auto" width="auto" bg-Color="transparent" onEntry="this.position='relative';" y="landscape.-32%,portrait.-26%" x="landscape.22%,portrait.31%">
|
|
53
|
+
<lido-text visible="true" id="righthandle1" tab-index="2" value="" height="126px" width="120px" type="drop"></lido-text>
|
|
54
|
+
</lido-cell>
|
|
55
|
+
<!-- dragElements -->
|
|
56
|
+
<lido-cell visible="true" height="130px" width="80%" layout="row" onEntry="this.position='relative';" y="-35px">
|
|
57
|
+
<lido-image is-slice="true" height="126px" width="188px" audio="" id="drag1" value="${leftValue}" tab-index="3" visible="true" x="78%" y="0%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/balancing/big_fruit.png" type="drag">
|
|
58
|
+
<lido-text font-family="'Baloo Bhai 2'" height="126px" width="188px" audio="" visible="true" onEntry="this.fontWeight='600';" string="${leftValue}" fontColor="black" font-size="40px"></lido-text>
|
|
59
|
+
</lido-image>
|
|
60
|
+
<lido-image is-slice="true" height="126px" width="188px" audio="" id="drag2" value="${rightValue}" tab-index="4" visible="true" x="78%" y="0%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/balancing/big_fruit.png" type="drag">
|
|
61
|
+
<lido-text font-family="'Baloo Bhai 2'" height="126px" width="188px" audio="" visible="true" onEntry="this.fontWeight='600';" string="${rightValue}" fontColor="black" font-size="40px"></lido-text>
|
|
62
|
+
</lido-image>
|
|
63
|
+
</lido-cell>
|
|
64
|
+
</lido-container>
|
|
65
|
+
</main>
|
|
66
|
+
`;
|
|
67
|
+
}
|