From 025410c28fe052f0889f09b79d29e9f97fc2f114 Mon Sep 17 00:00:00 2001 From: nhkimmm Date: Tue, 14 Apr 2026 15:37:27 +0900 Subject: [PATCH] fix(viz): draw hyperedges in network coords to fix HiDPI offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vis-network's afterDrawing hook passes a ctx that already has the view transform (pan + zoom + devicePixelRatio) applied. The previous drawHyperedges manually re-applied (p - offset) * scale + canvas.width/2 on top of that ctx, which double-applied the transform and — because canvas.width is the physical pixel buffer, not the CSS width — mis-anchored on HiDPI by cssWidth/2 to the right and cssHeight/2 down. Result: hyperedge polygons rendered detached from their nodes in the lower-right area of the canvas on Retina displays. Accept the ctx from the callback argument and draw node positions raw, so hyperedges use the same coordinate path as nodes and edges. --- graphify/export.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/graphify/export.py b/graphify/export.py index f0ee66ba..a7078193 100644 --- a/graphify/export.py +++ b/graphify/export.py @@ -62,9 +62,11 @@ def _hyperedge_script(hyperedges_json: str) -> str: return f"""