Skip to content

Commit

Permalink
Merge pull request #7413 from caadxyz/main
Browse files Browse the repository at this point in the history
Update p5.Geometry.js by fixed cap color problem
  • Loading branch information
davepagurek authored Dec 6, 2024
2 parents 7aafe3e + 1108271 commit 9e582a2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/webgl/p5.Geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,12 @@ p5.Geometry = class Geometry {
const currEdge = this.edges[i];
const begin = this.vertices[currEdge[0]];
const end = this.vertices[currEdge[1]];
const prevColor = (this.vertexStrokeColors.length > 0 && prevEdge)
? this.vertexStrokeColors.slice(
prevEdge[1] * 4,
(prevEdge[1] + 1) * 4
)
: [0, 0, 0, 0];
const fromColor = this.vertexStrokeColors.length > 0
? this.vertexStrokeColors.slice(
currEdge[0] * 4,
Expand Down Expand Up @@ -2056,7 +2062,7 @@ p5.Geometry = class Geometry {
this.vertices[prevEdge[1]],
lastValidDir,
existingCap.dir.copy().mult(-1),
fromColor
prevColor
);
potentialCaps.delete(prevEdge[1]);
connected.add(prevEdge[1]);
Expand All @@ -2065,7 +2071,7 @@ p5.Geometry = class Geometry {
potentialCaps.set(prevEdge[1], {
point: this.vertices[prevEdge[1]],
dir: lastValidDir,
color: fromColor
color: prevColor
});
}
lastValidDir = undefined;
Expand Down

0 comments on commit 9e582a2

Please sign in to comment.