Skip to content

Commit

Permalink
fix: parentElement不存在 (#292)
Browse files Browse the repository at this point in the history
Co-authored-by: xuying.xu <[email protected]>
  • Loading branch information
tangying1027 and xuying.xu authored Aug 15, 2024
1 parent a44da86 commit dcb6e94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/f-react/src/createCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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);
Expand Down

0 comments on commit dcb6e94

Please sign in to comment.