ソースを参照

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(() => {