From 0753353cf7e7ca5d899b3210d16f8d0d111f7c13 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Tue, 10 Aug 2021 13:36:50 +0200 Subject: [PATCH] Remove obsolete/unused properties and parameters --- .../Models/ImageUrlGenerationOptions.cs | 17 ----------------- .../ValueConverters/ImageCropperValue.cs | 12 +++++------- .../ImageCropperTemplateCoreExtensions.cs | 2 +- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/Umbraco.Core/Models/ImageUrlGenerationOptions.cs b/src/Umbraco.Core/Models/ImageUrlGenerationOptions.cs index 3118162786..9f4943dc68 100644 --- a/src/Umbraco.Core/Models/ImageUrlGenerationOptions.cs +++ b/src/Umbraco.Core/Models/ImageUrlGenerationOptions.cs @@ -1,5 +1,3 @@ -using System; - namespace Umbraco.Cms.Core.Models { /// @@ -15,21 +13,12 @@ namespace Umbraco.Cms.Core.Models public int? Height { get; set; } - [Obsolete("This property is unsupported by the default implementation, manually calculate the width based on the height instead.")] - public decimal? WidthRatio { get; set; } - - [Obsolete("This property is unsupported by the default implementation, manually calculate the height based on the width instead.")] - public decimal? HeightRatio { get; set; } - public int? Quality { get; set; } public ImageCropMode? ImageCropMode { get; set; } public ImageCropAnchor? ImageCropAnchor { get; set; } - [Obsolete("Images are already cropped from the center to the specified width/height by default.")] - public bool DefaultCrop { get; set; } - public FocalPointPosition FocalPoint { get; set; } public CropCoordinates Crop { get; set; } @@ -38,12 +27,6 @@ namespace Umbraco.Cms.Core.Models public string FurtherOptions { get; set; } - [Obsolete("This property is unsupported by the default implementation, images should always be resized to the specified dimensions (within the configured maximums) to prevent different sizes depending on the source image.")] - public bool UpScale { get; set; } = true; - - [Obsolete("This property is unsupported by the default implementation, all frames should be processed by default.")] - public string AnimationProcessMode { get; set; } - /// /// The focal point position, in whatever units the registered IImageUrlGenerator uses, typically a percentage of the total image from 0.0 to 1.0. /// diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/ImageCropperValue.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/ImageCropperValue.cs index 09e080e0b0..6cce8899fb 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/ImageCropperValue.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/ImageCropperValue.cs @@ -63,11 +63,9 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters : Crops.FirstOrDefault(x => x.Alias.InvariantEquals(alias)); } - public ImageUrlGenerationOptions GetCropBaseOptions(string url, ImageCropperCrop crop, bool defaultCrop, bool preferFocalPoint) + public ImageUrlGenerationOptions GetCropBaseOptions(string url, ImageCropperCrop crop, bool preferFocalPoint) { - if (preferFocalPoint && HasFocalPoint() - || crop != null && crop.Coordinates == null && HasFocalPoint() - || defaultCrop && HasFocalPoint()) + if ((preferFocalPoint && HasFocalPoint()) || (crop != null && crop.Coordinates == null && HasFocalPoint())) { return new ImageUrlGenerationOptions(url) { FocalPoint = new ImageUrlGenerationOptions.FocalPointPosition(FocalPoint.Top, FocalPoint.Left) }; } @@ -92,7 +90,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters if (crop == null && !string.IsNullOrWhiteSpace(alias)) return null; - var options = GetCropBaseOptions(string.Empty, crop, string.IsNullOrWhiteSpace(alias), useFocalPoint); + var options = GetCropBaseOptions(null, crop, useFocalPoint || string.IsNullOrWhiteSpace(alias)); if (crop != null && useCropDimensions) { @@ -108,9 +106,9 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters /// /// Gets the value image URL for a specific width and height. /// - public string GetCropUrl(int width, int height, IImageUrlGenerator imageUrlGenerator, bool useFocalPoint = false, string cacheBusterValue = null) + public string GetCropUrl(int width, int height, IImageUrlGenerator imageUrlGenerator, string cacheBusterValue = null) { - var options = GetCropBaseOptions(string.Empty, null, true, useFocalPoint); + var options = GetCropBaseOptions(null, null, false); options.Width = width; options.Height = height; diff --git a/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs b/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs index 00d4dcdb77..ae7e391bba 100644 --- a/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs @@ -332,7 +332,7 @@ namespace Umbraco.Extensions return null; } - options = cropDataSet.GetCropBaseOptions(imageUrl, crop, string.IsNullOrWhiteSpace(cropAlias), preferFocalPoint); + options = cropDataSet.GetCropBaseOptions(imageUrl, crop, preferFocalPoint || string.IsNullOrWhiteSpace(cropAlias)); if (crop != null & useCropDimensions) {