From a21f661abfe06e098eb8a6ca590b706d4a7248cf Mon Sep 17 00:00:00 2001 From: wangzemei Date: Thu, 5 Sep 2024 16:13:17 +0800 Subject: [PATCH] + [task#127424] add region coloring logic of think3c widget. --- lib/zin/wg/think3c/js/v1.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index 2b4c865fb2..6d94c0b04e 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -202,7 +202,26 @@ function colorRegions(binaryImageData) ctx.save(); ctx.fillStyle = colors[colorIndex % colors.length]; + + /* 遍历区域所有行,进行颜色填充。 */ + /* Traverse all rows in the region and fill them with colors. */ + region.rows.forEach((row, key) => { + if(row) + { + if(Array.isArray(row)) + { + row.forEach((item) => { + ctx.fillRect(item.left, key, item.right - item.left + 1, 1); + }); + } + else + { + ctx.fillRect(row.left, key, row.right - row.left + 1, 1); + } + } + }); }); + resolve(canvas.toDataURL()); }; });