Date: Fri, 6 Dec 2024 17:06:05 +0000 Subject: [PATCH 2/2] =?UTF-8?q?show=20`points=20of=20interest=20=E1=B4=AE?= =?UTF-8?q?=E1=B4=B1=E1=B5=80=E1=B4=AC`=20crops=20in=20the=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Frederick O'Brien --- .../js/components/gr-display-crops/gr-display-crops.html | 2 +- kahuna/public/js/image/controller.js | 6 +++++- kahuna/public/js/image/crop.html | 4 ++-- kahuna/public/js/util/crop.js | 9 ++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kahuna/public/js/components/gr-display-crops/gr-display-crops.html b/kahuna/public/js/components/gr-display-crops/gr-display-crops.html index 80db07d7aa..3c5d9e5b27 100644 --- a/kahuna/public/js/components/gr-display-crops/gr-display-crops.html +++ b/kahuna/public/js/components/gr-display-crops/gr-display-crops.html @@ -14,7 +14,7 @@
  • -
    {{crop.specification.aspectRatio | asCropType}}
    +
    {{crop.specification | asCropType}}
    {{crop.master.dimensions.width}} x {{crop.master.dimensions.height}}
      diff --git a/kahuna/public/js/image/controller.js b/kahuna/public/js/image/controller.js index 47a8ecbb16..68bfd03166 100644 --- a/kahuna/public/js/image/controller.js +++ b/kahuna/public/js/image/controller.js @@ -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); diff --git a/kahuna/public/js/image/crop.html b/kahuna/public/js/image/crop.html index 69b234426a..573a3f193f 100644 --- a/kahuna/public/js/image/crop.html +++ b/kahuna/public/js/image/crop.html @@ -5,7 +5,7 @@
      - {{:: crop.specification.aspectRatio | asCropType}} + {{:: crop.specification | asCropType}} ({{:: crop.specification.aspectRatio}})
      @@ -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}}" >
      diff --git a/kahuna/public/js/util/crop.js b/kahuna/public/js/util/crop.js index 554c2f2936..ba18f022dd 100644 --- a/kahuna/public/js/util/crop.js +++ b/kahuna/public/js/util/crop.js @@ -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'; @@ -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; }; });