Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut committed Mar 18, 2019
1 parent 2f04c56 commit b7c1156
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tools/auto-crop.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const autoCrop = (store, settings, uc) => {
const {crop: cropSettings, multiple} = settings
const {crop, multiple} = settings
const {image} = store.getState()

// auto-crop only in single file mode
if (!cropSettings || !multiple) {
if (!crop || !multiple) {
return
}

// if even one of crop option sets allow free crop,
// we don't need to crop automatically
if (cropSettings.some(c => !c.preferedSize)) {
if (crop.some(c => !c.preferedSize)) {
return
}

Expand All @@ -24,7 +24,7 @@ const autoCrop = (store, settings, uc) => {
true
)

const crop = {
const cropEffect = {
originalSize: [info.width, info.height],
coords: {
left: Math.round((info.width - size[0]) / 2),
Expand All @@ -34,7 +34,7 @@ const autoCrop = (store, settings, uc) => {
},
}

store.setAppliedEffect({crop})
store.setAppliedEffect({crop: cropEffect})
store.rebuildImage()
}

Expand Down

0 comments on commit b7c1156

Please sign in to comment.