forked from Public/pics
Rewrite CropEditor.positionBoundary
This commit is contained in:
parent
8e7a09f3f3
commit
5895f4faa6
@ -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";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user