diff options
Diffstat (limited to 'cnn_v3')
| -rw-r--r-- | cnn_v3/tools/tester.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cnn_v3/tools/tester.js b/cnn_v3/tools/tester.js index a138e12..fd2b7bd 100644 --- a/cnn_v3/tools/tester.js +++ b/cnn_v3/tools/tester.js @@ -493,11 +493,13 @@ class CNNv3Tester { const wrap = document.getElementById('chzoomWrap'); const dst = document.getElementById('chzoom'); const lbl = document.getElementById('chzoomLbl'); - // Size: fill panel width, height follows aspect ratio - dst.width = tex.width; - dst.height = tex.height; - dst.style.width = '100%'; - dst.style.height = 'auto'; + // Size: fit canvas to available container width (height:auto doesn't work on <canvas>) + const maxW = wrap.clientWidth - 12; // subtract wrap padding + const scale = Math.min(1, maxW / tex.width); + dst.width = Math.round(tex.width * scale); + dst.height = Math.round(tex.height * scale); + dst.style.width = ''; + dst.style.height = ''; lbl.textContent = label; wrap.style.display = 'flex'; // Re-render via WebGPU (WebGPU canvas pixels are not readable by drawImage) |
