Skip to content

Commit

Permalink
feat(canvas): set feat/supportsCSSTransform to true by default (#5526)
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini authored Sep 11, 2023
1 parent ae3138c commit ab59152
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions __tests__/unit/api/chart.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ describe('Chart', () => {
});
});

it('Chart({...}) should set canvas.supportsCSSTransform to true.', async () => {
const chart = new Chart();
await chart.render();
expect(chart.getContext().canvas?.getConfig().supportsCSSTransform).toBe(
true,
);
});

it('chart.getContainer() should return container.', () => {
const container = document.createElement('div');
const chart = new Chart({ container });
Expand Down
1 change: 1 addition & 0 deletions src/api/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class Runtime<Spec extends G2Spec = G2Spec> extends CompositionNode {
render(): Promise<Runtime<Spec>> {
if (this._rendering) return this._addToTrailing();
if (!this._context.canvas) this._createCanvas();
this._context.canvas.getConfig().supportsCSSTransform = true;
this._bindAutoFit();
this._rendering = true;
const finished = new Promise<Runtime<Spec>>((resolve, reject) =>
Expand Down

0 comments on commit ab59152

Please sign in to comment.