File size: 2,167 Bytes
ed9f15f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**

 * Image Display - Handle image preview and display

 */

import { setCurrentImage } from '../state.js';

/**

 * Display image in main preview

 */
export async function displayMainImage(imageData) {
    const preview = document.getElementById('mainImagePreview');
    const img = document.getElementById('mainImage');
    const placeholder = preview.querySelector('.placeholder');
    
    if (!img || !placeholder) return;
    
    img.src = imageData;
    img.style.display = 'block';
    placeholder.style.display = 'none';
    
    setCurrentImage(imageData);
    
    // Reset zoom level and transform
    import('../state.js').then(module => {
        module.setZoomLevel(1);
    });
    img.style.transform = 'scale(1)';
    
    // Update zoom display
    const zoomDisplay = document.getElementById('zoomLevel');
    if (zoomDisplay) {
        zoomDisplay.textContent = 'Zoom: 100%';
    }
    
    // Enable zoom controls
    const zoomIn = document.getElementById('zoomIn');
    const zoomOut = document.getElementById('zoomOut');
    const zoomReset = document.getElementById('zoomReset');
    
    if (zoomIn) zoomIn.disabled = false;
    if (zoomOut) zoomOut.disabled = false;
    if (zoomReset) zoomReset.disabled = false;
}

/**

 * Display image in quick preview

 */
export function displayQuickImage(imageData) {
    const preview = document.getElementById('quickImagePreview');
    const img = document.getElementById('quickImage');
    const placeholder = preview.querySelector('.placeholder');
    
    if (!img || !placeholder) return;
    
    img.src = imageData;
    img.style.display = 'block';
    placeholder.style.display = 'none';
}

/**

 * Display cropped embryo

 */
export function displayCroppedEmbryo(index, detection, totalCount) {
    const img = document.getElementById('croppedImage');
    const counter = document.getElementById('embryoCounter');
    
    if (img) {
        img.src = detection.imageData;
        img.style.display = 'block';
    }
    
    if (counter) {
        counter.textContent = `Embryo ${index + 1} of ${totalCount}`;
    }
}