mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 02:49:06 +00:00
Fix old version volume exception #1653
This commit is contained in:
@@ -53,16 +53,17 @@ public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
|
|||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value is double v)
|
||||||
|
{
|
||||||
|
// Clump to range [0, 1]
|
||||||
|
v = Math.Max(0d, Math.Min(v, 1d));
|
||||||
|
|
||||||
|
if (v < 0.01d) return Volumes[0];
|
||||||
|
|
||||||
|
return Volumes[1 + (int)(v / 0.34d)];
|
||||||
|
}
|
||||||
|
|
||||||
return Volumes[0];
|
return Volumes[0];
|
||||||
|
|
||||||
var v = (double)value;
|
|
||||||
if (Math.Abs(v) < 0.01)
|
|
||||||
return Volumes[0];
|
|
||||||
|
|
||||||
v = Math.Min(v, 1);
|
|
||||||
|
|
||||||
return Volumes[1 + (int)(v / 0.34)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
Reference in New Issue
Block a user