From 7331de0567374846ab9e60924cb7bfe8d3f0a818 Mon Sep 17 00:00:00 2001 From: xuying <33517362+tangying1027@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:16:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20parentElement=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=20(#289)?= 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/f-react/src/createCanvas.tsx b/packages/f-react/src/createCanvas.tsx index 7f528eb..c5cb423 100644 --- a/packages/f-react/src/createCanvas.tsx +++ b/packages/f-react/src/createCanvas.tsx @@ -107,6 +107,7 @@ const createCanvas = (CanvasClass: typeof Canvas) => { }); const targetNode = this.canvasRef.current?.parentElement; + if (targetNode) return; const { width, height } = targetNode.getBoundingClientRect(); this.parentNode = { width: Math.round(width), @@ -133,6 +134,7 @@ const createCanvas = (CanvasClass: typeof Canvas) => { resize() { const targetNode = this.canvasRef.current?.parentElement; + if (targetNode) return; const { width, height } = targetNode.getBoundingClientRect(); const lastWidth = Math.round(width); const lastHeight = Math.round(height);