Skip to content

Commit

Permalink
BUGFIX: respect default option in cropping
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaip committed Apr 9, 2018
1 parent 1f5b705 commit 6d1b1de
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const DEFAULT_BOUNDARIES = {
};

const determineInitialAspectRatioStrategy = (image, neosConfiguration) => {
const {options} = neosConfiguration;
const {options, defaultOption} = neosConfiguration;
const aspectRatioLocked = neosConfiguration.locked.height > 0 && neosConfiguration.locked.width > 0;
if (aspectRatioLocked) {
return new LockedAspectRatioStrategy(neosConfiguration.locked.width, neosConfiguration.locked.height);
Expand Down Expand Up @@ -174,6 +174,10 @@ const determineInitialAspectRatioStrategy = (image, neosConfiguration) => {
.map(o => new ConfiguredAspectRatioStrategy(o.width, o.height, o.label))
)

.orElse(
when(defaultOption)(new ConfiguredAspectRatioStrategy(options[defaultOption].width, options[defaultOption].height, options[defaultOption].label))
)

//
// As last resort, assume that no aspect ratio was applied so far
//
Expand Down

0 comments on commit 6d1b1de

Please sign in to comment.