This is an automated email from the ASF dual-hosted git repository.

bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new d88ef477f7 Include node height/width in center-on-task logic (#30924)
d88ef477f7 is described below

commit d88ef477f7daf86d2ec9ad6650e75d00e5e78e36
Author: Brent Bovenzi <[email protected]>
AuthorDate: Thu Apr 27 19:26:16 2023 -0400

    Include node height/width in center-on-task logic (#30924)
---
 airflow/www/static/js/dag/details/graph/index.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/airflow/www/static/js/dag/details/graph/index.tsx 
b/airflow/www/static/js/dag/details/graph/index.tsx
index 00ece2c5e5..31578869cf 100644
--- a/airflow/www/static/js/dag/details/graph/index.tsx
+++ b/airflow/www/static/js/dag/details/graph/index.tsx
@@ -107,7 +107,13 @@ const Graph = ({ openGroupIds, onToggleGroups, 
hoveredTaskState }: Props) => {
       const x = node?.positionAbsolute?.x || node?.position.x;
       const y = node?.positionAbsolute?.y || node?.position.y;
       if (!x || !y) return;
-      setCenter(x, y, { duration: 1000 });
+      setCenter(
+        x + (node.data.width || 0) / 2,
+        y + (node.data.height || 0) / 2,
+        {
+          duration: 1000,
+        }
+      );
     }
   };
 

Reply via email to