Make crop editor usable #22

Merged
Aaron merged 27 commits from crop-editor into master 2020-12-30 20:06:17 +01:00
Showing only changes of commit 5895f4faa6 - Show all commits

View File

@ -258,21 +258,10 @@ class CropEditor {
}
positionBoundary(event) {
let source_x = parseInt(this.source_x.value),
source_y = parseInt(this.source_y.value),
crop_width = parseInt(this.crop_width.value),
crop_height = parseInt(this.crop_height.value),
real_width = this.original_image.naturalWidth,
real_height = this.original_image.naturalHeight,
scaled_width = this.original_image.clientWidth,
scaled_height = this.original_image.clientHeight;
let width_scale = scaled_width / real_width,
height_scale = scaled_height / real_height;
crop_boundary.style.left = (this.source_x.value) * width_scale + "px";
crop_boundary.style.top = (this.source_y.value) * height_scale + "px";
crop_boundary.style.width = (this.crop_width.value) * width_scale + "px";
crop_boundary.style.height = (this.crop_height.value) * height_scale + "px";
let scaleFactor = this.getScaleFactor();
crop_boundary.style.left = parseInt(this.source_x.value) * scaleFactor + "px";
crop_boundary.style.top = parseInt(this.source_y.value) * scaleFactor + "px";
crop_boundary.style.width = parseInt(this.crop_width.value) * scaleFactor + "px";
crop_boundary.style.height = parseInt(this.crop_height.value) * scaleFactor + "px";
}
}