Convert screen position to image coordinates
| 310 | |
| 311 | // Convert screen position to image coordinates |
| 312 | static bool screen_to_image(const app_state& app, float sx, float sy, |
| 313 | float& ix, float& iy) { |
| 314 | if (app.canvas_w <= 0 || app.canvas_h <= 0) return false; |
| 315 | ix = (sx - app.canvas_x) / app.canvas_w * app.image.width; |
| 316 | iy = (sy - app.canvas_y) / app.canvas_h * app.image.height; |
| 317 | return ix >= 0 && iy >= 0 && ix < app.image.width && iy < app.image.height; |
| 318 | } |
| 319 | |
| 320 | // Draw a spinning indicator + message as a centered overlay |
| 321 | static void draw_busy_overlay(const char* message) { |