Skip to content

Commit 73ba867

Browse files
committed
fix(g-canvas): autoDraw should be true by default
1 parent ed4ddc3 commit 73ba867

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

packages/g-canvas/__tests__/unit/canvas-spec.js

-3
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ describe('canvas test', () => {
5656

5757
it('draw', (done) => {
5858
expect(getColor(canvas.get('context'), 10, 10)).eql('#000000');
59-
// 默认的 draw 是延迟的所以要延迟测试
60-
canvas.draw();
6159
expect(getColor(canvas.get('context'), 10, 10)).eql('#000000');
6260
setTimeout(() => {
6361
expect(getColor(canvas.get('context'), 10, 10)).eql('#ff0000');
@@ -88,7 +86,6 @@ describe('canvas test', () => {
8886
fill: 'red',
8987
},
9088
});
91-
canvas.draw();
9289
let called = false;
9390
let clickShape = null;
9491
canvas.on('click', (ev) => {

packages/g-canvas/src/canvas.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Canvas extends AbstractCanvas {
3838
getDefaultCfg() {
3939
const cfg = super.getDefaultCfg();
4040
// 是否自动绘制,不需要用户调用 draw 方法
41-
cfg['autoDraw'] = false;
41+
cfg['autoDraw'] = true;
4242
// 是否允许局部刷新图表
4343
cfg['localRefresh'] = true;
4444
cfg['refreshElements'] = [];

0 commit comments

Comments
 (0)