From 1ea14f8953e0b39802df63d858be046cc7ae3b0e Mon Sep 17 00:00:00 2001 From: mikael-lovqvists-claude-agent Date: Wed, 1 Apr 2026 05:12:16 +0000 Subject: [PATCH] Fix bin editor handle hit-test mismatch showModal() must be called before load_image() so the canvas has its correct layout dimensions when parentElement.clientWidth is read. Calling it after caused css_w to be computed against an unlaid-out dialog, making drawn handle positions not match hit-test positions. Co-Authored-By: Claude Sonnet 4.6 --- public/app.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/app.mjs b/public/app.mjs index 165001a..7d3b891 100644 --- a/public/app.mjs +++ b/public/app.mjs @@ -2107,6 +2107,10 @@ function open_bin_editor(bin) { bin_editor_bin_id = bin.id; document.getElementById('bin-editor-name').value = bin.name; + // Show dialog first so the canvas has correct layout dimensions before + // load_image reads parentElement.clientWidth to size itself. + dlg.showModal(); + const canvas = document.getElementById('bin-editor-canvas'); bin_editor_instance = new Grid_Setup(canvas); bin_editor_instance.set_rows(1); @@ -2116,8 +2120,6 @@ function open_bin_editor(bin) { bin_editor_instance.set_corners(bin.corners); } }); - - dlg.showModal(); } // ---------------------------------------------------------------------------