Make crop editor usable #22
@ -94,7 +94,7 @@ class CropEditor {
|
|||||||
// Cropping from the centre?
|
// Cropping from the centre?
|
||||||
if (cropMethod === "c") {
|
if (cropMethod === "c") {
|
||||||
// Crop vertically from the centre, using the entire width.
|
// Crop vertically from the centre, using the entire width.
|
||||||
if (sourceAspectRatio < cropAspectRatio) {
|
if (sourceAspectRatio <= cropAspectRatio) {
|
||||||
this.crop_width.value = source.naturalWidth;
|
this.crop_width.value = source.naturalWidth;
|
||||||
this.crop_height.value = Math.ceil(source.naturalWidth / cropAspectRatio);
|
this.crop_height.value = Math.ceil(source.naturalWidth / cropAspectRatio);
|
||||||
this.source_x.value = 0;
|
this.source_x.value = 0;
|
||||||
@ -111,9 +111,9 @@ class CropEditor {
|
|||||||
// Cropping a top or bottom slice?
|
// Cropping a top or bottom slice?
|
||||||
else {
|
else {
|
||||||
// Can we actually take a top or bottom slice from the original image?
|
// Can we actually take a top or bottom slice from the original image?
|
||||||
if (sourceAspectRatio < cropAspectRatio) {
|
if (sourceAspectRatio <= cropAspectRatio) {
|
||||||
this.crop_width.value = source.naturalWidth;
|
this.crop_width.value = source.naturalWidth;
|
||||||
this.crop_height.value = Math.floor(source.naturalHeight / cropAspectRatio);
|
this.crop_height.value = Math.floor(source.naturalWidth / cropAspectRatio);
|
||||||
this.source_x.value = "0";
|
this.source_x.value = "0";
|
||||||
this.source_y.value = cropMethod.indexOf("t") !== -1 ? "0" : source.naturalHeight - this.crop_height.value;
|
this.source_y.value = cropMethod.indexOf("t") !== -1 ? "0" : source.naturalHeight - this.crop_height.value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user