Skip to content

Commit

Permalink
fix: re-apply canvas text color with alpha (#435)
Browse files Browse the repository at this point in the history
this fixes #433
  • Loading branch information
wouterlucas authored Nov 6, 2024
2 parents b65e7a9 + 8ee508f commit be66859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/renderers/canvas/CanvasCoreRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class CanvasCoreRenderer extends CoreRenderer {

if (ctxTexture) {
const image = ctxTexture.getImage(color);
ctx.globalAlpha = alpha;
ctx.globalAlpha = color.a ?? alpha;
if (frame) {
ctx.drawImage(
image,
Expand Down
2 changes: 2 additions & 0 deletions src/core/text-rendering/renderers/CanvasTextRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ export class CanvasTextRenderer extends TextRenderer<CanvasTextRendererState> {
if (state.textureNode) {
// Use the existing texture node
state.textureNode.texture = texture;
// Update the alpha
state.textureNode.alpha = getNormalizedAlphaComponent(state.props.color);
} else {
// Create a new texture node
const textureNode = this.stage.createNode({
Expand Down

0 comments on commit be66859

Please sign in to comment.