From c25922273dea2b95794d9e1ce0b5a157a29ef351 Mon Sep 17 00:00:00 2001 From: songhn233 Date: Thu, 20 May 2021 12:29:28 +0800 Subject: [PATCH] fix(graph/fitView): add container width and height without config --- packages/pc/src/graph/graph.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/pc/src/graph/graph.ts b/packages/pc/src/graph/graph.ts index 331145bf1cf..f5c31f7c053 100644 --- a/packages/pc/src/graph/graph.ts +++ b/packages/pc/src/graph/graph.ts @@ -60,6 +60,12 @@ export default class Graph extends AbstractGraph implements IGraph { const { clientWidth, clientHeight } = container const width: number = this.get('width') || clientWidth; const height: number = this.get('height') || clientHeight; + + if (!this.get('width') && !this.get('height')) { + this.set('width', clientWidth); + this.set('height', clientHeight); + } + const renderer: string = this.get('renderer'); let canvas;