From dcb6e9480047a5bd0cb14273307b7087692dc19f Mon Sep 17 00:00:00 2001 From: xuying <33517362+tangying1027@users.noreply.github.com> Date: Thu, 15 Aug 2024 22:30:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20parentElement=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=20(#292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: xuying.xu --- packages/f-react/src/createCanvas.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/f-react/src/createCanvas.tsx b/packages/f-react/src/createCanvas.tsx index c5cb423..74350a4 100644 --- a/packages/f-react/src/createCanvas.tsx +++ b/packages/f-react/src/createCanvas.tsx @@ -107,7 +107,7 @@ const createCanvas = (CanvasClass: typeof Canvas) => { }); const targetNode = this.canvasRef.current?.parentElement; - if (targetNode) return; + if (!targetNode) return; const { width, height } = targetNode.getBoundingClientRect(); this.parentNode = { width: Math.round(width), @@ -134,7 +134,7 @@ const createCanvas = (CanvasClass: typeof Canvas) => { resize() { const targetNode = this.canvasRef.current?.parentElement; - if (targetNode) return; + if (!targetNode) return; const { width, height } = targetNode.getBoundingClientRect(); const lastWidth = Math.round(width); const lastHeight = Math.round(height);