()
| 722 | if (loading.querySelector('p')) { |
| 723 | loading.querySelector('p').textContent = `Loading bundle preview (0/${toLoad.length})...`; |
| 724 | } |
| 725 | fileType.textContent = ''; |
| 726 | dimensions.textContent = ''; |
| 727 | updatePreviewSlicerButton(); |
| 728 | |
| 729 | dialog.showModal(); |
| 730 | await new Promise((resolve) => setTimeout(resolve, 100)); |
| 731 | initPreviewScene(); |
| 732 | |
| 733 | const root = new THREE.Group(); |
| 734 | const placed = []; |
| 735 | let loadFailures = 0; |
| 736 | |
| 737 | for (let i = 0; i < toLoad.length; i++) { |
| 738 | const child = toLoad[i]; |
| 739 | const loadingText = loading.querySelector('p'); |
| 740 | if (loadingText) { |
| 741 | loadingText.textContent = |
| 742 | `Loading bundle preview (${i + 1}/${toLoad.length})...\n${child.fileName || ''}`; |
| 743 | } |
| 744 | |
| 745 | try { |
| 746 | const obj = await createPreviewObjectFromPath(child.filePath, loadToken); |
| 747 | applyPartTint(obj, i, toLoad.length); |
| 748 | |
| 749 | const box = new THREE.Box3().setFromObject(obj); |
| 750 | const center = box.getCenter(new THREE.Vector3()); |
| 751 | const size = box.getSize(new THREE.Vector3()); |
| 752 | obj.position.sub(center); |
| 753 | placed.push({ obj, size }); |
| 754 | } catch (error) { |
| 755 | const message = error && error.message ? error.message : ''; |
| 756 | if (message === 'Preview cancelled' || message.includes('Preview cancelled')) { |
| 757 | return; |
| 758 | } |
| 759 | console.warn('Bundle preview skipped:', child.filePath, error); |
| 760 | loadFailures++; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | if (loadToken !== previewLoadToken) return; |
| 765 | |
| 766 | if (!placed.length) { |
| 767 | loading.innerHTML = ` |
no outgoing calls
no test coverage detected