소스 검색

center widget on data change

Aykut Saraç 2 년 전
부모
커밋
c76da1fb22
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/components/Graph/index.tsx

+ 2 - 2
src/components/Graph/index.tsx

@@ -92,12 +92,12 @@ const GraphComponent = ({
         requestAnimationFrame(() => {
           setTimeout(() => {
             setLoading(false);
-            setTimeout(() => changeRatio > 100 && centerView(), 0);
+            setTimeout(() => (changeRatio > 100 || isWidget) && centerView(), 0);
           }, 0);
         });
       }
     },
-    [centerView, setLoading, size.height, size.width]
+    [centerView, isWidget, setLoading, size.height, size.width]
   );
 
   const onCanvasClick = React.useCallback(() => {