Skip to content

Commit 9e582a2

Browse files
authored
Merge pull request #7413 from caadxyz/main
Update p5.Geometry.js by fixed cap color problem
2 parents 7aafe3e + 1108271 commit 9e582a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/webgl/p5.Geometry.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,12 @@ p5.Geometry = class Geometry {
19931993
const currEdge = this.edges[i];
19941994
const begin = this.vertices[currEdge[0]];
19951995
const end = this.vertices[currEdge[1]];
1996+
const prevColor = (this.vertexStrokeColors.length > 0 && prevEdge)
1997+
? this.vertexStrokeColors.slice(
1998+
prevEdge[1] * 4,
1999+
(prevEdge[1] + 1) * 4
2000+
)
2001+
: [0, 0, 0, 0];
19962002
const fromColor = this.vertexStrokeColors.length > 0
19972003
? this.vertexStrokeColors.slice(
19982004
currEdge[0] * 4,
@@ -2056,7 +2062,7 @@ p5.Geometry = class Geometry {
20562062
this.vertices[prevEdge[1]],
20572063
lastValidDir,
20582064
existingCap.dir.copy().mult(-1),
2059-
fromColor
2065+
prevColor
20602066
);
20612067
potentialCaps.delete(prevEdge[1]);
20622068
connected.add(prevEdge[1]);
@@ -2065,7 +2071,7 @@ p5.Geometry = class Geometry {
20652071
potentialCaps.set(prevEdge[1], {
20662072
point: this.vertices[prevEdge[1]],
20672073
dir: lastValidDir,
2068-
color: fromColor
2074+
color: prevColor
20692075
});
20702076
}
20712077
lastValidDir = undefined;

0 commit comments

Comments
 (0)