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.
This commit is contained in:
BarZ 2023-04-28 14:30:52 +08:00
parent 3c0c6c8a3e
commit 83482a2440

View File

@ -1120,7 +1120,7 @@ export class Transformer extends Group {
_batchChangeChild(selector: string, attrs: any) { _batchChangeChild(selector: string, attrs: any) {
const anchor = this.findOne(selector); const anchor = this.findOne(selector);
anchor.setAttrs(attrs); if (anchor) anchor.setAttrs(attrs);
} }
update() { update() {