@@ -4,6 +4,7 @@ import { landscape, portrait, video, square, freeform, cropOptions } from './con
44
55const CROP_TYPE_STORAGE_KEY = 'cropType' ;
66const CUSTOM_CROP_STORAGE_KEY = 'customCrop' ;
7+ const SHOULD_SHOW_CROP_GUTTERS_IF_APPLICABLE_STORAGE_KEY = 'shouldShowCropGuttersIfApplicable' ;
78
89const customCrop = ( label , xRatio , yRatio ) => {
910 return { key :label , ratio : xRatio / yRatio , ratioString : `${ xRatio } :${ yRatio } ` } ;
@@ -61,7 +62,15 @@ cropUtil.factory('cropSettings', ['storage', function(storage) {
6162 }
6263 } ;
6364
64- function set ( { cropType, customRatio} ) {
65+ const setShouldShowCropGuttersIfApplicable = shouldShowCropGuttersIfApplicableStr => {
66+ storage . setJs (
67+ SHOULD_SHOW_CROP_GUTTERS_IF_APPLICABLE_STORAGE_KEY ,
68+ shouldShowCropGuttersIfApplicableStr === "true" ,
69+ true
70+ ) ;
71+ } ;
72+
73+ function set ( { cropType, customRatio, shouldShowCropGuttersIfApplicable} ) {
6574 // set customRatio first in case cropType relies on a custom crop
6675 if ( customRatio ) {
6776 setCustomCrop ( customRatio ) ;
@@ -71,6 +80,10 @@ cropUtil.factory('cropSettings', ['storage', function(storage) {
7180 setCropType ( cropType ) ;
7281 }
7382
83+ if ( shouldShowCropGuttersIfApplicable ) {
84+ setShouldShowCropGuttersIfApplicable ( shouldShowCropGuttersIfApplicable ) ;
85+ }
86+
7487 }
7588
7689 function getCropType ( ) {
@@ -81,7 +94,11 @@ cropUtil.factory('cropSettings', ['storage', function(storage) {
8194 }
8295 }
8396
84- return { set, getCropType, getCropOptions } ;
97+ function shouldShowCropGuttersIfApplicable ( ) {
98+ return storage . getJs ( SHOULD_SHOW_CROP_GUTTERS_IF_APPLICABLE_STORAGE_KEY , true ) ;
99+ }
100+
101+ return { set, getCropType, getCropOptions, shouldShowCropGuttersIfApplicable } ;
85102} ] ) ;
86103
87104cropUtil . filter ( 'asCropType' , function ( ) {
0 commit comments