You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by jh...@apache.org on 2021/08/09 22:52:35 UTC
[airflow] 37/39: fix: change graph focus to top of view instead of
center (#16484)
This is an automated email from the ASF dual-hosted git repository.
jhtimmins pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit f479effded98911f4a5cf53788cd540583813688
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Wed Jun 16 13:20:19 2021 -0500
fix: change graph focus to top of view instead of center (#16484)
(cherry picked from commit f1675853a5ed9b779ee2fc13bb9aa97185472bc7)
---
airflow/www/static/js/graph.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js
index 6482d91..5d8ab8e 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -553,7 +553,6 @@ function focusedGroupKey() {
function focusGroup(nodeId) {
if (nodeId != null && zoom != null) {
const { x } = g.node(nodeId);
- const { y } = g.node(nodeId);
// This is the total canvas size.
const { width, height } = svg.node().getBoundingClientRect();
@@ -572,7 +571,8 @@ function focusGroup(nodeId) {
1.5, // cap zoom level to 1.5 so nodes are not too large
) * 0.9;
- const [deltaX, deltaY] = [width / 2 - x * scale, height / 2 - y * scale];
+ // deltaY of 5 keeps the zoom at the top of the view but with a slight margin
+ const [deltaX, deltaY] = [width / 2 - x * scale, 5];
zoom.translate([deltaX, deltaY]);
zoom.scale(scale);
zoom.event(innerSvg.transition().duration(duration));