Skip to content

Commit

Permalink
show points of interest ᴮᴱᵀᴬ crops in the UI
Browse files Browse the repository at this point in the history
Co-authored-by: Frederick O'Brien <[email protected]>
  • Loading branch information
twrichards and frederickobrien committed Dec 6, 2024
1 parent 1f1313d commit b59dfb0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<li class="image-info__group--dl gr-display-crops__crop"
ng-repeat="crop in ctrl.crops">
<div class="gr-display-crops__crop__list image-info__group--dl__key image-info__heading">
<div>{{crop.specification.aspectRatio | asCropType}}</div>
<div>{{crop.specification | asCropType}}</div>
<div>{{crop.master.dimensions.width}} x {{crop.master.dimensions.height}}</div>
</div>
<ul>
Expand Down
6 changes: 5 additions & 1 deletion kahuna/public/js/image/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ image.controller('ImageCtrl', [
}
ctrl.crop = crops.find(crop => crop.id === cropKey);
ctrl.fullCrop = crops.find(crop => crop.specification.type === 'full');
ctrl.crops = crops.filter(crop => crop.specification.type === 'crop');
ctrl.crops = [
...crops.filter(crop => crop.specification.type === 'crop'),
// for POI, we can't use crops as the S3 crops are full frame and won't match up
...esCrops.filter(crop => crop.specification.type === 'poi')
];
ctrl.image.allCrops = ctrl.fullCrop ? [ctrl.fullCrop].concat(ctrl.crops) : ctrl.crops;
//boolean version for use in template
ctrl.hasFullCrop = angular.isDefined(ctrl.fullCrop);
Expand Down
4 changes: 2 additions & 2 deletions kahuna/public/js/image/crop.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="image-crop__info"
ng-class="{'image-crop__info--selected': crop == ctrl.crop}">
<div class="flex-container">
{{:: crop.specification.aspectRatio | asCropType}}
{{:: crop.specification | asCropType}}
<span class="flex-spacer"></span>
<span ng-if="crop.specification.aspectRatio">({{:: crop.specification.aspectRatio}})</span>
</div>
Expand All @@ -21,6 +21,6 @@
data-thumbnail="{{:: extremeAssets.smallest | assetFile}}"
data-embeddable-url="{{:: ctrl.image.data.id | embeddableUrl:crop.id}}"
data-aspect-ratio="{{:: crop.specification.aspectRatio}}"
data-crop-type="{{:: crop.specification.aspectRatio | asCropType}}"
data-crop-type="{{:: crop.specification | asCropType}}"
></asset-handle>
</div>
9 changes: 6 additions & 3 deletions kahuna/public/js/util/crop.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import angular from 'angular';

import { landscape, portrait, video, square, freeform, cropOptions } from './constants/cropOptions';
import {landscape, portrait, video, square, freeform, cropOptions, pointsOfInterestBeta} from './constants/cropOptions';

const CROP_TYPE_STORAGE_KEY = 'cropType';
const CUSTOM_CROP_STORAGE_KEY = 'customCrop';
Expand Down Expand Up @@ -123,8 +123,11 @@ cropUtil.factory('cropSettings', ['storage', function(storage) {
}]);

cropUtil.filter('asCropType', function() {
return ratioString => {
const cropSpec = cropOptions.find(_ => _.ratioString === ratioString) || freeform;
return specification => {
if (specification.type === "poi"){
return pointsOfInterestBeta.key;
}
const cropSpec = cropOptions.find(_ => _.ratioString === specification.aspectRatio) || freeform;
return cropSpec.key;
};
});
Expand Down

0 comments on commit b59dfb0

Please sign in to comment.