You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ry...@apache.org on 2021/06/16 18:21:33 UTC
[airflow] branch main updated: fix: change graph focus to top of
view instead of center (#16484)
This is an automated email from the ASF dual-hosted git repository.
ryanahamilton 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 f167585 fix: change graph focus to top of view instead of center (#16484)
f167585 is described below
commit f1675853a5ed9b779ee2fc13bb9aa97185472bc7
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)
---
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 917aa90..1f422ff 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -541,7 +541,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();
@@ -560,7 +559,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));