lido-player 0.0.2-alpha-51-dev → 0.0.2-alpha-53-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.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +199 -73
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-dc02d753.js → utils-3c1ce74e.js} +236 -101
- package/dist/collection/components/avatar/lido-avatar.js +1 -1
- package/dist/collection/components/canvas/lido-canvas.css +5 -8
- package/dist/collection/components/canvas/lido-canvas.js +2 -2
- 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 +24 -2
- package/dist/collection/components/flashCard/lido-flash-card.js +1 -1
- package/dist/collection/components/home/lido-home.css +4 -0
- package/dist/collection/components/home/lido-home.js +27 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +14 -14
- 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/shape/lido-shape.js +1 -1
- package/dist/collection/components/trace/lido-trace.js +122 -47
- package/dist/collection/components/wrap/lido-wrap.js +1 -1
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +26 -25
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +3 -1
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +1 -1
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +1 -1
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
- package/dist/collection/stories/Templates/blender/blender.stories.js +100 -0
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +1 -1
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +6 -2
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +1 -1
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +1 -1
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +1 -1
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +3 -2
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +1 -1
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +3 -1
- package/dist/collection/stories/Templates/grid/grid.stories.js +5 -1
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +1 -1
- package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +4 -2
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +1 -1
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +3 -1
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +4 -2
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +1 -1
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +1 -1
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +1 -1
- package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +1 -1
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +6 -4
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +1 -1
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +2 -2
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +2 -2
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +14 -13
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +14 -13
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +1 -1
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +5 -1
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +1 -1
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +1 -1
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +1 -1
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +1 -1
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +3 -1
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +2 -2
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +6 -6
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +7 -6
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +1 -1
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +25 -21
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +1 -1
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +8 -6
- package/dist/collection/stories/Templates/total/total.stories.js +1 -1
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +1 -1
- package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +2 -2
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +6 -6
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +1 -1
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +7 -6
- package/dist/collection/utils/utils.js +155 -27
- package/dist/collection/utils/utilsHandlers/animationHandler.js +38 -0
- package/dist/collection/utils/utilsHandlers/clickHandler.js +5 -1
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +29 -64
- package/dist/collection/utils/utilsHandlers/slideHandler.js +7 -6
- package/dist/collection/utils/utilsHandlers/sortHandler.js +3 -5
- 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 +2 -2
- 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 +23 -23
- 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-56c8f3da.js → p-004adc43.js} +3 -3
- package/dist/components/{p-c8815e84.js → p-057fb7b8.js} +48 -24
- package/dist/components/{p-bb907e43.js → p-0733b277.js} +2 -2
- package/dist/components/{p-6ba0f1af.js → p-09b3b152.js} +1 -1
- package/dist/components/{p-74b90a9c.js → p-23549651.js} +8 -8
- package/dist/components/{p-d7693f47.js → p-3e8ae1c5.js} +123 -48
- package/dist/components/{p-6be6c5eb.js → p-3f0e4436.js} +2 -2
- package/dist/components/{p-d0131159.js → p-511377d2.js} +236 -102
- package/dist/components/{p-a8724f06.js → p-561908ec.js} +2 -2
- package/dist/components/{p-1c84cf65.js → p-567983a9.js} +13 -7
- package/dist/components/{p-b89371ac.js → p-6beee44b.js} +1 -1
- package/dist/components/{p-1f3c2783.js → p-71ded596.js} +2 -2
- package/dist/components/{p-0fbeb3a1.js → p-73e3f0f4.js} +12 -6
- package/dist/components/{p-b7efadad.js → p-875c1411.js} +2 -2
- package/dist/components/{p-4fd6b588.js → p-8774f517.js} +2 -2
- package/dist/components/{p-04e904b5.js → p-90f7dd48.js} +1 -1
- package/dist/components/{p-caa05d1e.js → p-92b9ae9e.js} +2 -2
- package/dist/components/{p-e9548986.js → p-9ea1a67d.js} +26 -4
- package/dist/components/{p-bef96764.js → p-b3e67e7f.js} +2 -2
- package/dist/components/{p-988477ad.js → p-cca545f9.js} +2 -2
- package/dist/components/{p-d3f7d561.js → p-d2fe2bb6.js} +2 -2
- package/dist/components/{p-12432f23.js → p-d568d595.js} +1 -1
- package/dist/components/{p-62d2a5b3.js → p-df1af62c.js} +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +199 -73
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-b5eb2360.js → utils-eefe4a1c.js} +236 -102
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-4d9ad047.entry.js +1 -0
- package/dist/lido-player/{p-9fd87d44.js → p-589fc3b8.js} +2 -2
- package/dist/types/components/canvas/lido-canvas.d.ts +1 -1
- package/dist/types/components/container/lido-container.d.ts +1 -0
- package/dist/types/components/home/lido-home.d.ts +1 -0
- package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +0 -1
- package/dist/types/components/trace/lido-trace.d.ts +1 -0
- package/dist/types/components.d.ts +0 -6
- package/dist/types/stories/Templates/blender/blender.stories.d.ts +4 -0
- package/dist/types/utils/utils.d.ts +1 -1
- package/dist/types/utils/utilsHandlers/animationHandler.d.ts +1 -0
- package/package.json +1 -1
- package/dist/lido-player/p-e1a9c26f.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H,
|
|
1
|
+
import { p as proxyCustomElement, H, W as TraceMode, e as convertUrlToRelative, d as setVisibilityWithDelay, X as speakIcon, o as executeActions, J as triggerNextContainer, L as LidoContainer, k as parseProp, h, j as Host, Y as fingerUrl } from './p-511377d2.js';
|
|
2
2
|
|
|
3
3
|
const lidoTraceCss = ":host{display:block;position:relative}#lido-svgContainer{display:flex;justify-content:center;align-items:center;overflow:hidden}svg{width:100%;height:100%;touch-action:none}#lido-draggableCircle{cursor:pointer;fill:#CF1565;transition:fill 0.2s, r 0.2s}.lido-blindTracing{stroke:none !important}.lido-blindFreeTrace{stroke:none !important}.lido-hovered{cursor:grab;fill:darkred}#lido-controls{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:space-between;padding:10px;background-color:#f0f0f0;border-top:1px solid #ccc}button{padding:10px;font-size:16px}@media (max-width: 600px){button{padding:8px;font-size:14px}}.lido-trace-path-green{}.lido-flow-indicator{stroke:blue;stroke-width:2;stroke-dasharray:6, 6;fill:none}.lido-trace{height:700px;width:700px;z-index:1;justify-items:center;align-content:center}.trace-animate{animation:trace-bounce 0.5s}@keyframes trace-bounce{0%{transform:scale(1)}30%{transform:scale(1.05)}60%{transform:scale(0.95)}100%{transform:scale(1)}}";
|
|
4
4
|
const LidoTraceStyle0 = lidoTraceCss;
|
|
@@ -36,6 +36,7 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
36
36
|
this.fileIndex = -1;
|
|
37
37
|
this.isDragging = false;
|
|
38
38
|
this.activePointerId = null;
|
|
39
|
+
this.freeTraceUpdateCounter = 0;
|
|
39
40
|
this.idleTimer = null;
|
|
40
41
|
this.fingerImg = null;
|
|
41
42
|
}
|
|
@@ -52,8 +53,8 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
52
53
|
circle: null,
|
|
53
54
|
paths: [],
|
|
54
55
|
svg: null,
|
|
55
|
-
proximityThreshold:
|
|
56
|
-
freeTraceProximityThreshold:
|
|
56
|
+
proximityThreshold: 375, // Increased general proximity threshold (was 100)
|
|
57
|
+
freeTraceProximityThreshold: 350, // Increased proximity for free trace (was 50)
|
|
57
58
|
rafId: null,
|
|
58
59
|
pointerMoveEvent: null,
|
|
59
60
|
activePointerId: null,
|
|
@@ -389,7 +390,7 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
389
390
|
}
|
|
390
391
|
// Modified handlePointerMove function
|
|
391
392
|
handlePointerMove(state) {
|
|
392
|
-
var _a, _b, _c, _d;
|
|
393
|
+
var _a, _b, _c, _d, _e, _f;
|
|
393
394
|
if (!state.isDragging)
|
|
394
395
|
return;
|
|
395
396
|
if (!state.circle || !state.paths || state.paths.length === 0)
|
|
@@ -401,6 +402,15 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
401
402
|
x: parseFloat(state.circle.getAttribute('cx')),
|
|
402
403
|
y: parseFloat(state.circle.getAttribute('cy')),
|
|
403
404
|
};
|
|
405
|
+
// Only update if pointer moved a minimum distance (to reduce unnecessary updates)
|
|
406
|
+
const MOVE_THRESHOLD = 1; // px
|
|
407
|
+
if (state.lastPointerPos) {
|
|
408
|
+
const dx = pointerPos.x - state.lastPointerPos.x;
|
|
409
|
+
const dy = pointerPos.y - state.lastPointerPos.y;
|
|
410
|
+
if (dx * dx + dy * dy < MOVE_THRESHOLD * MOVE_THRESHOLD) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
404
414
|
const currentPath = state.paths[state.currentPathIndex];
|
|
405
415
|
if (!currentPath) {
|
|
406
416
|
console.error('No valid path found at the current index');
|
|
@@ -428,48 +438,76 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
428
438
|
}
|
|
429
439
|
// For free trace mode and blind free trace mode, allow free drawing only if within the reduced proximity threshold
|
|
430
440
|
if (state.mode === TraceMode.FreeTrace || state.mode === TraceMode.BlindFreeTrace) {
|
|
441
|
+
// Throttle: Only update every 2nd event (for reducing excessive dom updates)
|
|
442
|
+
this.freeTraceUpdateCounter = (this.freeTraceUpdateCounter || 0) + 1;
|
|
443
|
+
if (this.freeTraceUpdateCounter % 2 !== 0) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
431
446
|
// Initialize the currentFreePath array if it's not created
|
|
432
447
|
if (!state.currentFreePath) {
|
|
433
448
|
state.currentFreePath = [];
|
|
434
449
|
}
|
|
435
|
-
// Create a new
|
|
450
|
+
// Create a new polyline element if it's the first trace for the current path index
|
|
436
451
|
if (!state.currentFreePath[state.currentPathIndex]) {
|
|
437
|
-
const
|
|
438
|
-
// newPath.setAttribute('stroke', 'green');
|
|
452
|
+
const newPolyline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');
|
|
439
453
|
const strokeWidth = state.paths[state.currentPathIndex].style['stroke-width'] || state.paths[state.currentPathIndex].getAttribute('stroke-width');
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
454
|
+
newPolyline.setAttribute('stroke-width', strokeWidth);
|
|
455
|
+
newPolyline.setAttribute('fill', 'none');
|
|
456
|
+
newPolyline.setAttribute('stroke-linecap', 'round');
|
|
457
|
+
newPolyline.setAttribute('stroke', 'lightgreen');
|
|
458
|
+
newPolyline.setAttribute('points', `${pointerPos.x},${pointerPos.y}`);
|
|
459
|
+
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.appendChild(newPolyline);
|
|
460
|
+
state.currentFreePath[state.currentPathIndex] = newPolyline;
|
|
461
|
+
// Store points array for this polyline
|
|
462
|
+
state.currentFreePolylinePoints = state.currentFreePolylinePoints || [];
|
|
463
|
+
state.currentFreePolylinePoints[state.currentPathIndex] = [
|
|
464
|
+
{ x: pointerPos.x, y: pointerPos.y }
|
|
465
|
+
];
|
|
448
466
|
// Reset lastPointerPos for the new path
|
|
449
467
|
state.lastPointerPos = pointerPos;
|
|
468
|
+
// Add a points counter to limit path growth
|
|
469
|
+
state.freeTracePointsCount = 1;
|
|
450
470
|
}
|
|
451
|
-
//
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
//
|
|
459
|
-
state.
|
|
471
|
+
// Limit the number of points in the free trace path for performance
|
|
472
|
+
const MAX_FREE_TRACE_POINTS = 10;
|
|
473
|
+
state.freeTracePointsCount = (state.freeTracePointsCount || 1) + 1;
|
|
474
|
+
if (state.freeTracePointsCount > MAX_FREE_TRACE_POINTS) {
|
|
475
|
+
// If limit reached, skip adding more points
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
// Add the new point to the polyline's points array
|
|
479
|
+
state.currentFreePolylinePoints = state.currentFreePolylinePoints || [];
|
|
480
|
+
let pointsArr = state.currentFreePolylinePoints[state.currentPathIndex] || [];
|
|
481
|
+
pointsArr.push({ x: pointerPos.x, y: pointerPos.y });
|
|
482
|
+
state.currentFreePolylinePoints[state.currentPathIndex] = pointsArr;
|
|
483
|
+
// Update the polyline's points attribute
|
|
484
|
+
const pointsStr = pointsArr.map(pt => `${pt.x},${pt.y}`).join(' ');
|
|
485
|
+
state.currentFreePath[state.currentPathIndex].setAttribute('points', pointsStr);
|
|
460
486
|
// Move the draggable circle with the freehand trace
|
|
461
487
|
state.circle.setAttribute('cx', pointerPos.x.toString());
|
|
462
488
|
state.circle.setAttribute('cy', pointerPos.y.toString());
|
|
463
|
-
//
|
|
464
|
-
(_b = state.svg) === null || _b === void 0 ? void 0 : _b.
|
|
489
|
+
// Only re-append if not already children list
|
|
490
|
+
const childNodes = (_b = state.svg) === null || _b === void 0 ? void 0 : _b.childNodes;
|
|
491
|
+
let circleFound = false;
|
|
492
|
+
for (let i = 0; i < ((childNodes === null || childNodes === void 0 ? void 0 : childNodes.length) || 0); i++) {
|
|
493
|
+
const child = childNodes === null || childNodes === void 0 ? void 0 : childNodes.item(i);
|
|
494
|
+
if (child && child.tagName === 'circle') {
|
|
495
|
+
circleFound = true;
|
|
496
|
+
break; // No need to continue once found
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
// If not found, append the circle
|
|
500
|
+
if (!circleFound && state.circle) {
|
|
501
|
+
(_c = state.svg) === null || _c === void 0 ? void 0 : _c.appendChild(state.circle);
|
|
502
|
+
}
|
|
465
503
|
// Update the last pointer position
|
|
466
504
|
state.lastPointerPos = pointerPos;
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
// If close to the end of the path, move to the next path
|
|
470
|
-
if (distanceToEnd < 5) {
|
|
505
|
+
// For polyline, estimate the end by number of points (not path length)
|
|
506
|
+
if (pointsArr.length >= MAX_FREE_TRACE_POINTS) {
|
|
471
507
|
this.moveToNextPath(state);
|
|
472
508
|
state.currentFreePath[state.currentPathIndex] = null; // Reset free path for next path
|
|
509
|
+
state.currentFreePolylinePoints[state.currentPathIndex] = [];
|
|
510
|
+
state.freeTracePointsCount = 0;
|
|
473
511
|
}
|
|
474
512
|
// this.resetIdleTimer(state); // ← keep timer alive
|
|
475
513
|
return; // Exit early since we're in free trace or blind free trace mode
|
|
@@ -477,24 +515,57 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
477
515
|
// In normal modes, allow movement and drawing only within the general proximity threshold
|
|
478
516
|
if (state.isDragging && closestPoint.length >= state.lastLength) {
|
|
479
517
|
state.lastLength = closestPoint.length;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
518
|
+
// Only update the circle if it moved enough
|
|
519
|
+
if (Math.abs(closestPoint.x - circlePos.x) > MOVE_THRESHOLD || Math.abs(closestPoint.y - circlePos.y) > MOVE_THRESHOLD) {
|
|
520
|
+
state.circle.setAttribute('cx', closestPoint.x.toString());
|
|
521
|
+
state.circle.setAttribute('cy', closestPoint.y.toString());
|
|
522
|
+
}
|
|
523
|
+
// Only re-append if not already children list
|
|
524
|
+
const childNodes = (_d = state.svg) === null || _d === void 0 ? void 0 : _d.childNodes;
|
|
525
|
+
let circleFound = false;
|
|
526
|
+
for (let i = 0; i < ((childNodes === null || childNodes === void 0 ? void 0 : childNodes.length) || 0); i++) {
|
|
527
|
+
const child = childNodes === null || childNodes === void 0 ? void 0 : childNodes.item(i);
|
|
528
|
+
if (child && child.tagName === 'circle') {
|
|
529
|
+
circleFound = true;
|
|
530
|
+
break; // No need to continue once found
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
// If not found, append the circle
|
|
534
|
+
if (!circleFound && state.circle) {
|
|
535
|
+
(_e = state.svg) === null || _e === void 0 ? void 0 : _e.appendChild(state.circle);
|
|
536
|
+
}
|
|
537
|
+
(_f = currentPath.greenPath) === null || _f === void 0 ? void 0 : _f.setAttribute('stroke-dashoffset', (state.totalPathLength - state.lastLength).toString());
|
|
538
|
+
// Completion logic for closed paths: only allow completion if almost all points are traced
|
|
539
|
+
const COMPLETION_THRESHOLD = 0.90; // 90% of the path must be traced
|
|
540
|
+
let percentComplete = state.lastLength / state.totalPathLength;
|
|
541
|
+
let startPoint = currentPath.getPointAtLength(0);
|
|
542
|
+
let endPoint = currentPath.getPointAtLength(currentPath.getTotalLength());
|
|
543
|
+
let pathIsClosed = this.getDistanceSquared(startPoint, endPoint) < 200; // threshold for overlap
|
|
544
|
+
if (pathIsClosed && state.totalPathLength > 50) {
|
|
545
|
+
if (percentComplete >= COMPLETION_THRESHOLD) {
|
|
546
|
+
if (state.currentPathIndex < state.paths.length - 1) {
|
|
547
|
+
this.moveToNextPath(state);
|
|
548
|
+
}
|
|
549
|
+
else if (state.currentPathIndex === state.paths.length - 1) {
|
|
550
|
+
this.moveToNextContainer();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
// For open paths, allow completion if near the end
|
|
556
|
+
if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex < state.paths.length - 1) {
|
|
557
|
+
this.moveToNextPath(state);
|
|
558
|
+
}
|
|
559
|
+
else if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex === state.paths.length - 1) {
|
|
560
|
+
this.moveToNextContainer();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
493
563
|
}
|
|
494
564
|
// this.resetIdleTimer(state); // ← keep timer alive
|
|
495
565
|
}
|
|
496
566
|
// Move to the next container after completing the current SVG
|
|
497
567
|
async moveToNextContainer() {
|
|
568
|
+
this.isDragging = false;
|
|
498
569
|
if (this.moving)
|
|
499
570
|
return; // Prevent multiple calls
|
|
500
571
|
this.moving = true; // Set moving to true to prevent re-entrance
|
|
@@ -513,9 +584,12 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
513
584
|
this.moving = false;
|
|
514
585
|
return;
|
|
515
586
|
}
|
|
587
|
+
console.log('onCorrect:', this.onCorrect);
|
|
588
|
+
console.log('el :', this.el);
|
|
516
589
|
if (this.el && this.onCorrect) {
|
|
517
590
|
await executeActions(this.onCorrect, this.el);
|
|
518
591
|
}
|
|
592
|
+
console.log('All SVGs completed, hiding component.');
|
|
519
593
|
triggerNextContainer();
|
|
520
594
|
}
|
|
521
595
|
// Get the pointer position relative to the SVG
|
|
@@ -533,13 +607,13 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
533
607
|
const dy = p1.y - p2.y;
|
|
534
608
|
return dx * dx + dy * dy;
|
|
535
609
|
}
|
|
536
|
-
// Find the closest point on the given path to the specified point using two-pass sampling
|
|
610
|
+
// Find the closest point on the given path to the specified point using two-pass sampling (optimized)
|
|
537
611
|
getClosestPointOnPath(pathNode, point) {
|
|
538
612
|
const pathLength = pathNode.getTotalLength();
|
|
539
613
|
let closestPoint = { x: 0, y: 0, length: 0 };
|
|
540
614
|
let minDistanceSquared = Infinity;
|
|
541
|
-
//
|
|
542
|
-
const coarseStep =
|
|
615
|
+
// Optimized: Increase coarse steps for better performance
|
|
616
|
+
const coarseStep = 40; // was 20
|
|
543
617
|
let coarseClosestPoint = { x: 0, y: 0, length: 0 };
|
|
544
618
|
let coarseMinDistanceSquared = Infinity;
|
|
545
619
|
for (let i = 0; i <= pathLength; i += coarseStep) {
|
|
@@ -555,7 +629,7 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
555
629
|
}
|
|
556
630
|
}
|
|
557
631
|
// Second pass: fine sampling around coarseClosestPoint
|
|
558
|
-
const fineStep =
|
|
632
|
+
const fineStep = 6; // was 2
|
|
559
633
|
const searchStart = Math.max(coarseClosestPoint.length - coarseStep, 0);
|
|
560
634
|
const searchEnd = Math.min(coarseClosestPoint.length + coarseStep, pathLength);
|
|
561
635
|
for (let i = searchStart; i <= searchEnd; i += fineStep) {
|
|
@@ -715,7 +789,7 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
715
789
|
};
|
|
716
790
|
}
|
|
717
791
|
render() {
|
|
718
|
-
return (h(Host, { key: '
|
|
792
|
+
return (h(Host, { key: '3f12119394502b6750874aaa50f43bf42e9f63cc', 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: '4fddd90d12251c4020006690f8c769ab452c8f6a', style: this.style, id: "lido-svgContainer" })));
|
|
719
793
|
}
|
|
720
794
|
static get assetsDirs() { return ["svg", "images"]; }
|
|
721
795
|
get el() { return this; }
|
|
@@ -754,6 +828,7 @@ const LidoTrace = /*@__PURE__*/ proxyCustomElement(class LidoTrace extends H {
|
|
|
754
828
|
"fileIndex": [32],
|
|
755
829
|
"isDragging": [32],
|
|
756
830
|
"activePointerId": [32],
|
|
831
|
+
"freeTraceUpdateCounter": [32],
|
|
757
832
|
"idleTimer": [32],
|
|
758
833
|
"fingerImg": [32]
|
|
759
834
|
}, undefined, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, i as initEventsForElement, q as handlingChildElements, r as attachSpeakIcon, e as convertUrlToRelative, k as parseProp, h, j as Host } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, i as initEventsForElement, q as handlingChildElements, r as attachSpeakIcon, e as convertUrlToRelative, k as parseProp, h, j as Host } from './p-511377d2.js';
|
|
2
2
|
|
|
3
3
|
const lidoColCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}";
|
|
4
4
|
const LidoColStyle0 = lidoColCss;
|
|
@@ -80,7 +80,7 @@ const LidoCol = /*@__PURE__*/ proxyCustomElement(class LidoCol extends H {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
return (h(Host, { key: '
|
|
83
|
+
return (h(Host, { key: '7845d3364dd13cb42959f67610254ee892119c39', id: this.id, class: "lido-col", type: this.type, "tab-index": this.tabIndex, value: this.value, style: this.style, minDrops: this.minDrops, maxDrops: this.maxDrops, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, h("slot", { key: '09a68a30534c5ea83d7166acd720b4b8f23f494e' })));
|
|
84
84
|
}
|
|
85
85
|
get el() { return this; }
|
|
86
86
|
static get style() { return LidoColStyle0; }
|