增加了异常信息打印,图像显示增加为原来的两倍大小

This commit is contained in:
2026-03-03 10:24:39 +08:00
parent 999443ebd5
commit 9f54a0cb2e
3 changed files with 37 additions and 18 deletions

View File

@@ -402,12 +402,15 @@
// 创建临时 URL
const img = new Image();
img.onload = () => {
// 图片加载完成后
canvas.width = img.width;
canvas.height = img.height;
// 设置 canvas 尺寸
canvas.getContext('2d').drawImage(img, 0, 0);
// 绘制到 canvas
// 图片加载完成后放大一倍显示160x160 -> 320x320
const scale = 2;
canvas.width = img.width * scale;
canvas.height = img.height * scale;
const ctx = canvas.getContext('2d');
ctx.imageSmoothingEnabled = false;
// 关闭平滑,像素清晰放大
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
// 绘制到 canvas2 倍尺寸)
canvas.style.display = 'block';
placeholder.style.display = 'none';
// 显示 canvas隐藏占位符
@@ -467,7 +470,7 @@
});
document.querySelector('.menu-item.exit').onclick = doDisconnect;
// 断开按钮 -> 执行断开
document.getElementById('btnAbout').onclick = () => alert('远程显示工具\n与 RemoDispBus 协议兼容\n端口 7003');
document.getElementById('btnAbout').onclick = () => alert('阜阳师范大学物理与电子工程学院\nDTU 远程液晶屏幕通信工具');
// 关于按钮 -> 弹出说明
</script>
</body>