Remove obsolete/unused properties and parameters

This commit is contained in:
Ronald Barendse
2021-08-10 13:36:50 +02:00
parent 474b63a590
commit 0753353cf7
3 changed files with 6 additions and 25 deletions

View File

@@ -1,5 +1,3 @@
using System;
namespace Umbraco.Cms.Core.Models
{
/// <summary>
@@ -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; }
/// <summary>
/// The focal point position, in whatever units the registered IImageUrlGenerator uses, typically a percentage of the total image from 0.0 to 1.0.
/// </summary>

View File

@@ -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
/// <summary>
/// Gets the value image URL for a specific width and height.
/// </summary>
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;

View File

@@ -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)
{