From f79020538b29a952234a265b3500fb0aa274429f Mon Sep 17 00:00:00 2001 From: Marc Flerackers Date: Sun, 20 Oct 2024 08:31:03 +0900 Subject: [PATCH] Use color if set --- src/gfx/draw/drawLine.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gfx/draw/drawLine.ts b/src/gfx/draw/drawLine.ts index b746c4fb..af0ce4a4 100644 --- a/src/gfx/draw/drawLine.ts +++ b/src/gfx/draw/drawLine.ts @@ -313,6 +313,11 @@ export function _drawLinesBevel(opt: DrawLinesOpt) { for (let i = 0; i < vertices.length; i++) { attributes.pos[i * 2] = vertices[i].x + offset.x; attributes.pos[i * 2 + 1] = vertices[i].y + offset.y; + if (opt.color) { + attributes.color[i * 3] = opt.color.r; + attributes.color[i * 3 + 1] = opt.color.g; + attributes.color[i * 3 + 2] = opt.color.g; + } } drawRaw( @@ -510,6 +515,11 @@ export function _drawLinesRound(opt: DrawLinesOpt) { for (let i = 0; i < vertices.length; i++) { attributes.pos[i * 2] = vertices[i].x + offset.x; attributes.pos[i * 2 + 1] = vertices[i].y + offset.y; + if (opt.color) { + attributes.color[i * 3] = opt.color.r; + attributes.color[i * 3 + 1] = opt.color.g; + attributes.color[i * 3 + 2] = opt.color.g; + } } drawRaw( @@ -677,6 +687,11 @@ export function _drawLinesMiter(opt: DrawLinesOpt) { for (let i = 0; i < vertices.length; i++) { attributes.pos[i * 2] = vertices[i].x + offset.x; attributes.pos[i * 2 + 1] = vertices[i].y + offset.y; + if (opt.color) { + attributes.color[i * 3] = opt.color.r; + attributes.color[i * 3 + 1] = opt.color.g; + attributes.color[i * 3 + 2] = opt.color.g; + } } drawRaw(