From 252427f5c2781dfe85d1b77dbb1bc62a6ce7c384 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 15 Nov 2024 12:23:25 +0800 Subject: [PATCH] refactor: cloneNode copy complete config (#1841) * refactor: cloneNode copy complete config * test: update test case * chore: commit changeset --- .changeset/small-ravens-rescue.md | 5 +++++ __tests__/unit/abstract-renderer.spec.ts | 1 + packages/g-lite/src/display-objects/DisplayObject.ts | 5 +---- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/small-ravens-rescue.md diff --git a/.changeset/small-ravens-rescue.md b/.changeset/small-ravens-rescue.md new file mode 100644 index 000000000..4c7d1fb38 --- /dev/null +++ b/.changeset/small-ravens-rescue.md @@ -0,0 +1,5 @@ +--- +'@antv/g-lite': patch +--- + +cloneNode copy complete config diff --git a/__tests__/unit/abstract-renderer.spec.ts b/__tests__/unit/abstract-renderer.spec.ts index 15ec8c6bd..a826ba22f 100644 --- a/__tests__/unit/abstract-renderer.spec.ts +++ b/__tests__/unit/abstract-renderer.spec.ts @@ -10,6 +10,7 @@ describe('Abstract renderer', () => { enableCulling: false, enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, + enableRenderingOptimization: false, enableSizeAttenuation: true, }); diff --git a/packages/g-lite/src/display-objects/DisplayObject.ts b/packages/g-lite/src/display-objects/DisplayObject.ts index 2766e3d93..417015601 100644 --- a/packages/g-lite/src/display-objects/DisplayObject.ts +++ b/packages/g-lite/src/display-objects/DisplayObject.ts @@ -227,10 +227,7 @@ export class DisplayObject< const cloned = new (this.constructor as ConstructorTypeOf)({ // copy id & name // @see https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode#notes - id: this.id, - name: this.name, - className: this.name, - interactive: this.interactive, + ...this.config, style: clonedStyle, });