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>