refactor(editor-drawers): 减小门图标内边距计算范围,优化小尺寸区域的图标显示效果

This commit is contained in:
xudan 2025-12-01 15:57:08 +08:00
parent 1babdbee80
commit f6cebf903d

View File

@ -315,7 +315,7 @@ export function drawArea(ctx: CanvasRenderingContext2D, pen: MapPen): void {
const deviceStatus = (pen.area as any)?.deviceStatus;
const img = isConnected === false ? __doorImgClosed : deviceStatus === 1 ? __doorImgOpen : __doorImgClosed;
if (img && img.complete) {
const padding = Math.max(6, Math.min(20, Math.min(w, h) * 0.08));
const padding = Math.max(2, Math.min(10, Math.min(w, h) * 0.02));
const availW = Math.max(0, w - padding * 2);
const availH = Math.max(0, h - padding * 2);
const ratio = img.naturalWidth > 0 && img.naturalHeight > 0 ? img.naturalWidth / img.naturalHeight : 1;