fix: using save and restore

This commit is contained in:
zhbhun 2023-08-07 10:06:57 +08:00
parent b6dc446f7d
commit 6879fdc8fc

View File

@ -610,9 +610,10 @@ export class CanvasRenderer extends Renderer {
}); });
const scaledOffsetX = x / scaleX; const scaledOffsetX = x / scaleX;
const scaledOffsetY = y / scaleY; const scaledOffsetY = y / scaleY;
this.ctx.save();
this.ctx.scale(scaleX, scaleY); this.ctx.scale(scaleX, scaleY);
this.renderRepeat(scaledPath, pattern, scaledOffsetX, scaledOffsetY); this.renderRepeat(scaledPath, pattern, scaledOffsetX, scaledOffsetY);
this.ctx.scale(1 / scaleX, 1 / scaleY); this.ctx.restore();
} }
} else if (isLinearGradient(backgroundImage)) { } else if (isLinearGradient(backgroundImage)) {
const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [null, null, null]); const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [null, null, null]);