Procházet zdrojové kódy

center widget on data change

Aykut Saraç před 2 roky
rodič
revize
c76da1fb22
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  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(() => {