Initial Zoom, fix AD Creation
Some checks failed
CI / test (pull_request) Failing after 14s
API CI / api-tests (pull_request) Failing after 19s

This commit is contained in:
Tim Lorsbach
2026-06-10 21:51:21 +02:00
parent 66129f676d
commit d0173cf2b0
3 changed files with 24 additions and 7 deletions

View File

@ -22,7 +22,7 @@ function predictFromNode(url) {
// data = {{ pathway.d3_json | safe }};
// elem = 'vizdiv'
function draw(pathway, elem) {
const initialzoom = 2.5
const nodeRadius = 20;
const linkDistance = 100;
const chargeStrength = -200;
@ -63,7 +63,7 @@ function draw(pathway, elem) {
node.fx = width / 2 + depthMap.get(node.depth) * horizontalSpacing - ((nodesInLevel - 1) * horizontalSpacing) / 2;
}
node.fy = node.depth * levelSpacing + 50;
node.fy = (node.depth + initialzoom + 0.5) * levelSpacing + 50;
depthMap.set(node.depth, depthMap.get(node.depth) + 1);
});
}
@ -572,11 +572,12 @@ function draw(pathway, elem) {
.scaleExtent([0.5, 5])
.on("zoom", (event) => {
zoomable.attr("transform", event.transform);
});
})
// Apply zoom to the SVG element - this enables wheel zoom
svg.call(zoom);
svg.call(zoom.scaleBy, initialzoom);
// Also apply zoom to container to catch events that might not reach SVG
// This ensures drag-to-pan works even when clicking on empty space
container.call(zoom);