Skip to content

Commit b709fc8

Browse files
authored
fix: subTexture in canvas renderer (#501)
2 parents 6acce40 + bd5353a commit b709fc8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/core/renderers/canvas/CanvasCoreRenderer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ export class CanvasCoreRenderer extends CoreRenderer {
122122
const textureType = texture?.type;
123123
assertTruthy(textureType, 'Texture type is not defined');
124124

125-
// The Canvas2D renderer only supports image and color textures
125+
// The Canvas2D renderer only supports image and color textures and subTexture images
126126
if (
127127
textureType !== TextureType.image &&
128-
textureType !== TextureType.color
128+
textureType !== TextureType.color &&
129+
textureType !== TextureType.subTexture
129130
) {
130131
return;
131132
}
@@ -185,7 +186,11 @@ export class CanvasCoreRenderer extends CoreRenderer {
185186
ctx.clip(path);
186187
}
187188

188-
if (textureType === TextureType.image && ctxTexture) {
189+
if (
190+
(textureType === TextureType.image ||
191+
textureType === TextureType.subTexture) &&
192+
ctxTexture
193+
) {
189194
const image = ctxTexture.getImage(color);
190195
ctx.globalAlpha = color.a ?? alpha;
191196
if (frame) {

0 commit comments

Comments
 (0)