Allow grid corners to be dragged outside image bounds
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -152,10 +152,7 @@ export class Grid_Setup {
|
|||||||
const sp = this.#screen_pos(e);
|
const sp = this.#screen_pos(e);
|
||||||
if (this.#drag_idx !== -1) {
|
if (this.#drag_idx !== -1) {
|
||||||
const img_pos = this.#world_to_img(this.#to_world(sp));
|
const img_pos = this.#world_to_img(this.#to_world(sp));
|
||||||
this.#corners[this.#drag_idx] = {
|
this.#corners[this.#drag_idx] = img_pos;
|
||||||
x: Math.max(0, Math.min(this.#img.width, img_pos.x)),
|
|
||||||
y: Math.max(0, Math.min(this.#img.height, img_pos.y)),
|
|
||||||
};
|
|
||||||
this.#draw();
|
this.#draw();
|
||||||
} else if (this.#panning) {
|
} else if (this.#panning) {
|
||||||
this.#cam_x += sp.x - this.#pan_last.x;
|
this.#cam_x += sp.x - this.#pan_last.x;
|
||||||
|
|||||||
Reference in New Issue
Block a user