Skip to content

Commit

Permalink
fix: fix error occurred when setRenderer (#1861)
Browse files Browse the repository at this point in the history
* fix: fix error occured when setRenderer

* chore: commit changeset
  • Loading branch information
Aarebecca authored Nov 27, 2024
1 parent d4752e2 commit 840bf90
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-bulldogs-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/g-lite': patch
---

fix: fix error occured when setRenderer
1 change: 1 addition & 0 deletions __tests__/demos/bugfix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { test_pick } from './1747';
export { issue_1760 } from './1760';
export { textWordWrap } from './textWordWrap';
export { group_with_stroke } from './group-with-stroke';
export { switchRenderer } from './switch-renderer';
13 changes: 13 additions & 0 deletions __tests__/demos/bugfix/switch-renderer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Renderer } from '@antv/g-canvas';

export async function switchRenderer(context) {
const { canvas } = context;

await canvas.ready;

const renderer = new Renderer();

canvas.setRenderer(renderer);

console.log('switched');
}
2 changes: 1 addition & 1 deletion __tests__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ plot();
async function plot() {
if (currentContainer) {
currentContainer.remove();
if (canvas) canvas.destroy(false);
if (canvas) canvas.destroy();
if (prevAfter) prevAfter();
}
currentContainer = document.createElement('div');
Expand Down
1 change: 0 additions & 1 deletion __tests__/unit/abstract-renderer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Abstract renderer', () => {
enableRenderingOptimization: false,
enableDirtyRectangleRendering: true,
enableDirtyRectangleRenderingDebug: false,
enableRenderingOptimization: false,
enableSizeAttenuation: true,
});

Expand Down
2 changes: 0 additions & 2 deletions packages/g-lite/src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@ export class Canvas extends EventTarget implements ICanvas {
if (this.context.rBushRoot) {
// clear rbush
this.context.rBushRoot.clear();
this.context.rBushRoot = null;
this.context.renderingContext.root = null;
}

if (!skipTriggerEvent) {
Expand Down

0 comments on commit 840bf90

Please sign in to comment.