From 83482a2440cee57199b642ea4773eea3c89d8d8c Mon Sep 17 00:00:00 2001 From: BarZ Date: Fri, 28 Apr 2023 14:30:52 +0800 Subject: [PATCH] As the 'anchor' of the Transformer is undefined when there is no anchor (such as 'top-left', 'top-center', etc.), the code 'anchor.setAttrs(attrs)' causes an error: 'Cannot read properties of undefined (reading 'setAttrs')'. Therefore, I want to add an if statement to check for the existence of the 'anchor' before setting its attributes. --- src/shapes/Transformer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/Transformer.ts b/src/shapes/Transformer.ts index cedf77fe..ac887268 100644 --- a/src/shapes/Transformer.ts +++ b/src/shapes/Transformer.ts @@ -1120,7 +1120,7 @@ export class Transformer extends Group { _batchChangeChild(selector: string, attrs: any) { const anchor = this.findOne(selector); - anchor.setAttrs(attrs); + if (anchor) anchor.setAttrs(attrs); } update() {