Skip to content

Commit 370a5b1

Browse files
fix(renderer): Fix .pushTransform and .popTransform don't always transform paths correctly
1 parent c62d7b9 commit 370a5b1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/js-draw/src/rendering/renderers/AbstractRenderer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ export default abstract class AbstractRenderer {
204204
}
205205

206206
public pushTransform(transform: Mat33) {
207+
// Draw all pending paths that used the previous transform (if any).
208+
this.flushPath();
209+
207210
this.transformStack.push(this.selfTransform);
208211
this.setTransform(this.getCanvasToScreenTransform().rightMul(transform));
209212
}
@@ -213,6 +216,9 @@ export default abstract class AbstractRenderer {
213216
throw new Error('Unable to pop more transforms than have been pushed!');
214217
}
215218

219+
// Draw all pending paths that used the old transform (if any):
220+
this.flushPath();
221+
216222
this.setTransform(this.transformStack.pop() ?? null);
217223
}
218224

0 commit comments

Comments
 (0)