mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile - Blending mode fixes
Nodes editor - Adhere to cable display settings Profile - Added focus layer option
This commit is contained in:
1 parent
e401fdf964
commit
3f52279305
13 files changed
+115
-32
No files matched your search
@@ -18,7 +18,8 @@
|
||||
<shared:SKColorToStringConverter x:Key="SKColorToStringConverter" />
|
||||
<shared:SKColorToColorConverter x:Key="SKColorToColorConverter" />
|
||||
</UserControl.Resources>
|
||||
<Canvas>
|
||||
<Canvas PointerEnter="OnPointerEnter"
|
||||
PointerLeave="OnPointerLeave">
|
||||
<Path Name="CablePath"
|
||||
Stroke="{CompiledBinding CableColor, Converter={StaticResource ColorToSolidColorBrushConverter}}"
|
||||
StrokeThickness="4"
|
||||
|
||||
@@ -4,6 +4,7 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.ReactiveUI;
|
||||
@@ -51,4 +52,14 @@ public class CableView : ReactiveUserControl<CableViewModel>
|
||||
segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y);
|
||||
segment.Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y);
|
||||
}
|
||||
|
||||
private void OnPointerEnter(object? sender, PointerEventArgs e)
|
||||
{
|
||||
ViewModel?.UpdateDisplayValue(true);
|
||||
}
|
||||
|
||||
private void OnPointerLeave(object? sender, PointerEventArgs e)
|
||||
{
|
||||
ViewModel?.UpdateDisplayValue(false);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Screens.VisualScripting.Pins;
|
||||
using Artemis.UI.Shared;
|
||||
@@ -15,6 +17,9 @@ namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class CableViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly NodeScriptViewModel _nodeScriptViewModel;
|
||||
private readonly IPin _from;
|
||||
private readonly IPin _to;
|
||||
private ObservableAsPropertyHelper<Color>? _cableColor;
|
||||
private ObservableAsPropertyHelper<Point>? _fromPoint;
|
||||
private ObservableAsPropertyHelper<Point>? _toPoint;
|
||||
@@ -25,14 +30,19 @@ public class CableViewModel : ActivatableViewModelBase
|
||||
private PinViewModel? _toViewModel;
|
||||
private bool _displayValue;
|
||||
|
||||
public CableViewModel(NodeScriptViewModel nodeScriptViewModel, IPin from, IPin to)
|
||||
public CableViewModel(NodeScriptViewModel nodeScriptViewModel, IPin from, IPin to, ISettingsService settingsService)
|
||||
{
|
||||
_nodeScriptViewModel = nodeScriptViewModel;
|
||||
_from = from;
|
||||
_to = to;
|
||||
|
||||
AlwaysShowValues = settingsService.GetSetting("ProfileEditor.AlwaysShowValues", true);
|
||||
|
||||
if (from.Direction != PinDirection.Output)
|
||||
throw new ArtemisUIException("Can only create cables originating from an output pin");
|
||||
if (to.Direction != PinDirection.Input)
|
||||
throw new ArtemisUIException("Can only create cables targeted to an input pin");
|
||||
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
nodeScriptViewModel.PinViewModels.ToObservableChangeSet().Filter(p => ReferenceEquals(p.Pin, from)).Transform(model => FromViewModel = model).Subscribe().DisposeWith(d);
|
||||
@@ -65,12 +75,17 @@ public class CableViewModel : ActivatableViewModelBase
|
||||
.Select(tuple => tuple.Item1 != new Point(0, 0) && tuple.Item2 != new Point(0, 0))
|
||||
.ToProperty(this, vm => vm.Connected)
|
||||
.DisposeWith(d);
|
||||
|
||||
AlwaysShowValues.SettingChanged += AlwaysShowValuesOnSettingChanged;
|
||||
Disposable.Create(() => AlwaysShowValues.SettingChanged -= AlwaysShowValuesOnSettingChanged).DisposeWith(d);
|
||||
});
|
||||
|
||||
|
||||
DisplayValue = !nodeScriptViewModel.IsPreview;
|
||||
UpdateDisplayValue(false);
|
||||
}
|
||||
|
||||
public PluginSetting<bool> AlwaysShowValues { get; }
|
||||
|
||||
public PinViewModel? FromViewModel
|
||||
{
|
||||
get => _fromViewModel;
|
||||
@@ -86,13 +101,30 @@ public class CableViewModel : ActivatableViewModelBase
|
||||
public bool DisplayValue
|
||||
{
|
||||
get => _displayValue;
|
||||
set => _displayValue = value;
|
||||
set => RaiseAndSetIfChanged(ref _displayValue, value);
|
||||
}
|
||||
|
||||
public bool Connected => _connected?.Value ?? false;
|
||||
public bool IsFirst => _from.ConnectedTo[0] == _to;
|
||||
|
||||
public Point FromPoint => _fromPoint?.Value ?? new Point();
|
||||
public Point ToPoint => _toPoint?.Value ?? new Point();
|
||||
public Point ValuePoint => _valuePoint?.Value ?? new Point();
|
||||
public Color CableColor => _cableColor?.Value ?? new Color(255, 255, 255, 255);
|
||||
|
||||
private void AlwaysShowValuesOnSettingChanged(object? sender, EventArgs e)
|
||||
{
|
||||
UpdateDisplayValue(false);
|
||||
}
|
||||
|
||||
public void UpdateDisplayValue(bool hoveringOver)
|
||||
{
|
||||
if (_nodeScriptViewModel.IsPreview)
|
||||
DisplayValue = false;
|
||||
|
||||
if (hoveringOver)
|
||||
DisplayValue = true;
|
||||
else
|
||||
DisplayValue = AlwaysShowValues.Value && IsFirst;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class NodeScriptWindowViewModel : DialogViewModelBase<bool>
|
||||
|
||||
public PluginSetting<bool> ShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
||||
public PluginSetting<bool> ShowFullPaths => _settingsService.GetSetting("ProfileEditor.ShowFullPaths", false);
|
||||
public PluginSetting<bool> AlwaysShowValues => _settingsService.GetSetting("ProfileEditor.AlwaysShowValues", false);
|
||||
public PluginSetting<bool> AlwaysShowValues => _settingsService.GetSetting("ProfileEditor.AlwaysShowValues", true);
|
||||
|
||||
private void ExecuteToggleBooleanSetting(PluginSetting<bool> setting)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user