From c6b930b6d6b4af947be5a2d6bb3bb16e5003119c Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Fri, 17 Jul 2026 13:30:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=A4=9A=E4=BD=99=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 去掉高度计算中多余的 borderWidth * 2 - 调整边框绘制,向内偏移半个线宽 - 边框紧贴表格内容,无额外空白 --- server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 3cd6ac7..027328e 100644 --- a/server.js +++ b/server.js @@ -694,7 +694,7 @@ function generateTableImage(params) { const headerHeight = fontSize * 2.5; const rowHeight = fontSize * 2.2; const titleHeight = title ? fontSize * 3 : 0; - const tableHeight = headerHeight + rows.length * rowHeight + borderWidth * 2; + const tableHeight = headerHeight + rows.length * rowHeight; const finalHeight = tableHeight + titleHeight; // 创建正式 canvas @@ -763,8 +763,9 @@ function generateTableImage(params) { ctx.strokeStyle = themeConfig.borderColor; ctx.lineWidth = borderWidth; - // 外边框 - ctx.strokeRect(0, startY, finalWidth, tableHeight); + // 外边框(向内偏移半个线宽,确保边框完全在画布内) + const offset = borderWidth / 2; + ctx.strokeRect(offset, startY + offset, finalWidth - borderWidth, tableHeight - borderWidth); // 横线 ctx.beginPath();