port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
using System;
using Intromat.Views.Editors;
using NodeNetwork.Toolkit.ValueNode;
using ReactiveUI;
using Splat;
namespace Intromat.ViewModels.Editors
{
public class FloatValueEditorViewModel : ValueEditorViewModel<float>
{
private float _minValue;
private float _maxValue;
static FloatValueEditorViewModel()
{
Locator.CurrentMutable.Register(() => new FloatValueEditorView(), typeof(IViewFor<FloatValueEditorViewModel>));
}
public FloatValueEditorViewModel(float min = 0, float max = 1)
{
MinValue = min;
MaxValue = max;
Value = 0;
this.WhenAnyValue(vm => vm.Value)
.Subscribe(newValue =>
{
if (newValue > MaxValue)
{
var delta = newValue - MinValue;
MaxValue = newValue + delta;
}
else if (newValue < MinValue)
{
var delta = MaxValue - newValue;
MinValue = newValue - delta;
}
});
}
public float MinValue
{
get => _minValue;
set => this.RaiseAndSetIfChanged(ref _minValue, value);
}
public float MaxValue
{
get => _maxValue;
set => this.RaiseAndSetIfChanged(ref _maxValue, value);
}
}
}