Skip to content

Commit be66859

Browse files
authored
fix: re-apply canvas text color with alpha (#435)
this fixes #433
2 parents b65e7a9 + 8ee508f commit be66859

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/core/renderers/canvas/CanvasCoreRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class CanvasCoreRenderer extends CoreRenderer {
169169

170170
if (ctxTexture) {
171171
const image = ctxTexture.getImage(color);
172-
ctx.globalAlpha = alpha;
172+
ctx.globalAlpha = color.a ?? alpha;
173173
if (frame) {
174174
ctx.drawImage(
175175
image,

src/core/text-rendering/renderers/CanvasTextRenderer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ export class CanvasTextRenderer extends TextRenderer<CanvasTextRendererState> {
364364
if (state.textureNode) {
365365
// Use the existing texture node
366366
state.textureNode.texture = texture;
367+
// Update the alpha
368+
state.textureNode.alpha = getNormalizedAlphaComponent(state.props.color);
367369
} else {
368370
// Create a new texture node
369371
const textureNode = this.stage.createNode({

0 commit comments

Comments
 (0)