Consistent box size

This commit is contained in:
Dragon Fire
2024-03-24 14:16:47 -04:00
parent c1d62edd5c
commit 4bd5e6cbbf
+5 -4
View File
@@ -34,11 +34,12 @@ module.exports = class FacesCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
for (const face of faces) {
const lineSize = base.width / 70;
ctx.fillStyle = 'blue';
ctx.fillRect(face.box.xMin, face.box.yMin, 10, face.box.height);
ctx.fillRect(face.box.xMin, face.box.yMin, face.box.width, 10);
ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + 10, 10);
ctx.fillRect(face.box.xMax, face.box.yMin, 10, face.box.height);
ctx.fillRect(face.box.xMin, face.box.yMin, lineSize, face.box.height);
ctx.fillRect(face.box.xMin, face.box.yMin, face.box.width, lineSize);
ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + lineSize, lineSize);
ctx.fillRect(face.box.xMax, face.box.yMin, lineSize, face.box.height);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'faces.png' }] });
}