|
@@ -3,7 +3,8 @@ using Avalonia;
|
|
|
|
|
|
namespace PixiEditor.AvaloniaUI.Helpers.Converters;
|
|
|
|
|
|
-internal class TimelineSliderValueToMarginConverter : SingleInstanceMultiValueConverter<TimelineSliderValueToMarginConverter>
|
|
|
+internal class
|
|
|
+ TimelineSliderValueToMarginConverter : SingleInstanceMultiValueConverter<TimelineSliderValueToMarginConverter>
|
|
|
{
|
|
|
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
{
|
|
@@ -12,14 +13,20 @@ internal class TimelineSliderValueToMarginConverter : SingleInstanceMultiValueCo
|
|
|
|
|
|
public override object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
|
|
|
{
|
|
|
- if (values.Count != 4)
|
|
|
+ if (values.Count == 3)
|
|
|
{
|
|
|
- throw new ArgumentException("TimelineSliderValueToMarginConverter requires 3 values");
|
|
|
+ if (values[0] is double minimum && values[1] is double scale && values[2] is Vector offset)
|
|
|
+ {
|
|
|
+ return new Thickness((-minimum) * scale - offset.X, 0, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if (values[0] is int frame && values[1] is double minimum && values[2] is double scale && values[3] is Vector offset)
|
|
|
+ else if (values.Count == 4)
|
|
|
{
|
|
|
- return new Thickness((frame - minimum) * scale - offset.X, 0, 0, 0);
|
|
|
+ if (values[0] is int frame && values[1] is double minimum && values[2] is double scale &&
|
|
|
+ values[3] is Vector offset)
|
|
|
+ {
|
|
|
+ return new Thickness((frame - minimum) * scale - offset.X, 0, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return new Thickness();
|