From 6879fdc8fcd1314652dcb8ac03cde862f4c9a530 Mon Sep 17 00:00:00 2001 From: zhbhun Date: Mon, 7 Aug 2023 10:06:57 +0800 Subject: [PATCH] fix: using save and restore --- src/render/canvas/canvas-renderer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/render/canvas/canvas-renderer.ts b/src/render/canvas/canvas-renderer.ts index f6c0326..481a3ad 100644 --- a/src/render/canvas/canvas-renderer.ts +++ b/src/render/canvas/canvas-renderer.ts @@ -610,9 +610,10 @@ export class CanvasRenderer extends Renderer { }); const scaledOffsetX = x / scaleX; const scaledOffsetY = y / scaleY; + this.ctx.save(); this.ctx.scale(scaleX, scaleY); this.renderRepeat(scaledPath, pattern, scaledOffsetX, scaledOffsetY); - this.ctx.scale(1 / scaleX, 1 / scaleY); + this.ctx.restore(); } } else if (isLinearGradient(backgroundImage)) { const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [null, null, null]);