image resizer and settings percentage unit (#8674)

This commit is contained in:
Davide Giacometti
2020-12-21 15:55:50 +01:00
committed by GitHub
parent 34ff670e5b
commit 11bdbaa07f
3 changed files with 51 additions and 6 deletions

View File

@@ -52,7 +52,15 @@ namespace ImageResizer.Models
public ResizeFit Fit
{
get => _fit;
set => Set(ref _fit, value);
set
{
var previousFit = _fit;
Set(ref _fit, value);
if (!Equals(previousFit, value))
{
UpdateShowHeight();
}
}
}
[JsonProperty(PropertyName = "width")]
@@ -112,7 +120,7 @@ namespace ImageResizer.Models
private void UpdateShowHeight()
{
ShowHeight = Unit != ResizeUnit.Percent;
ShowHeight = Fit == ResizeFit.Stretch || Unit != ResizeUnit.Percent;
}
private double ConvertToPixels(double value, ResizeUnit unit, int originalValue, double dpi)