Crop editor: do not allow selections starting outside image bounds.

This commit is contained in:
Aaron van Geffen 2020-12-06 18:21:29 +01:00
parent d562c70667
commit 8147e2b97d
1 changed files with 11 additions and 2 deletions

View File

@ -224,9 +224,18 @@ class CropEditor {
if (this.isMoving) {
return false;
}
let dragStartX = event.x - this.image_container.offsetLeft;
let dragStartY = event.y - this.image_container.offsetTop;
if (dragStartX > this.original_image.clientWidth ||
dragStartY > this.original_image.clientHeight) {
return;
}
this.isDragging = true;
this.dragStartX = event.x - this.image_container.offsetLeft;
this.dragStartY = event.y - this.image_container.offsetTop;
this.dragStartX = dragStartX;
this.dragStartY = dragStartY;
}
cropSelectionEnd(event) {