Skip to content

Commit

Permalink
fix: update graphics command
Browse files Browse the repository at this point in the history
  • Loading branch information
F-star committed Jun 16, 2024
1 parent 665fbcb commit 4b1eab7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/src/commands/update_graphics_attrs_cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class UpdateGraphicsAttrsCmd implements ICommand {
console.warn(`graphics ${id} is lost.`);
return;
}
if (attrs.parentIndex) {
graphics.removeFromParent();
}
graphics.updateAttrs(attrs);
if (attrs.parentIndex) {
graphics.insertAtParent(graphics.attrs.parentIndex!.position);
Expand All @@ -40,6 +43,7 @@ export class UpdateGraphicsAttrsCmd implements ICommand {
const graphics = doc.getGraphicsById(id);
if (graphics) {
graphics.setDeleted(true);
graphics.removeFromParent();
}
}

Expand All @@ -66,6 +70,9 @@ export class UpdateGraphicsAttrsCmd implements ICommand {
console.warn(`graphics ${id} is lost.`);
return;
}
if (attrs.parentIndex) {
graphics.removeFromParent();
}
graphics.updateAttrs(attrs);
if (attrs.parentIndex) {
graphics.insertAtParent(graphics.attrs.parentIndex!.position);
Expand Down

0 comments on commit 4b1eab7

Please sign in to comment.