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 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 05:12:16 +00:00
parent c41fb42e16
commit 1ea14f8953

View File

@@ -2107,6 +2107,10 @@ function open_bin_editor(bin) {
bin_editor_bin_id = bin.id; bin_editor_bin_id = bin.id;
document.getElementById('bin-editor-name').value = bin.name; 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'); const canvas = document.getElementById('bin-editor-canvas');
bin_editor_instance = new Grid_Setup(canvas); bin_editor_instance = new Grid_Setup(canvas);
bin_editor_instance.set_rows(1); bin_editor_instance.set_rows(1);
@@ -2116,8 +2120,6 @@ function open_bin_editor(bin) {
bin_editor_instance.set_corners(bin.corners); bin_editor_instance.set_corners(bin.corners);
} }
}); });
dlg.showModal();
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------