mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed compile errors in Artemis.UI
This commit is contained in:
parent
81e83e59f6
commit
d171b947b7
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Artemis.Core.Properties;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Artemis.Core;
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Artemis.Core.Properties;
|
||||
using Artemis.Storage.Entities.Plugins;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
@ -36,9 +34,7 @@ public class PluginSetting<T> : CorePropertyChanged, IPluginSetting
|
||||
/// <summary>
|
||||
/// The value of the setting
|
||||
/// </summary>
|
||||
[AllowNull]
|
||||
[CanBeNull]
|
||||
public T Value
|
||||
public T? Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
|
||||
@ -4,8 +4,8 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Internal;
|
||||
using Artemis.Core.Properties;
|
||||
using Artemis.Storage.Entities.Profile.Nodes;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Artemis.Core;
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ public class DeviceVisualizer : Control
|
||||
private Rect MeasureDevice()
|
||||
{
|
||||
if (Device == null)
|
||||
return new Rect(0, 0, 0, 0);
|
||||
return new Rect();
|
||||
|
||||
Rect deviceRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
|
||||
Geometry geometry = new RectangleGeometry(deviceRect);
|
||||
|
||||
@ -56,7 +56,6 @@ public partial class DraggableNumberBox : UserControl
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<string?> SuffixProperty = AvaloniaProperty.Register<DraggableNumberBox, string?>(nameof(Suffix));
|
||||
|
||||
private readonly NumberBox _numberBox;
|
||||
private TextBox? _inputTextBox;
|
||||
private double _lastX;
|
||||
private bool _moved;
|
||||
@ -69,8 +68,7 @@ public partial class DraggableNumberBox : UserControl
|
||||
public DraggableNumberBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
_numberBox = this.Get<NumberBox>("NumberBox");
|
||||
_numberBox.Value = Value;
|
||||
NumberBox.Value = Value;
|
||||
|
||||
PointerPressed += OnPointerPressed;
|
||||
PointerMoved += OnPointerMoved;
|
||||
@ -167,11 +165,11 @@ public partial class DraggableNumberBox : UserControl
|
||||
|
||||
private void SetNumberBoxValue(double value)
|
||||
{
|
||||
if (!(Math.Abs(_numberBox.Value - Value) > 0.00001))
|
||||
if (!(Math.Abs(NumberBox.Value - Value) > 0.00001))
|
||||
return;
|
||||
|
||||
_updating = true;
|
||||
_numberBox.Value = Value;
|
||||
NumberBox.Value = Value;
|
||||
_updating = false;
|
||||
}
|
||||
|
||||
@ -189,7 +187,7 @@ public partial class DraggableNumberBox : UserControl
|
||||
private void OnPointerPressed(object? sender, PointerPressedEventArgs e)
|
||||
{
|
||||
PointerPoint point = e.GetCurrentPoint(this);
|
||||
_inputTextBox = _numberBox.FindDescendantOfType<TextBox>();
|
||||
_inputTextBox = NumberBox.FindDescendantOfType<TextBox>();
|
||||
_moved = false;
|
||||
_startX = point.Position.X;
|
||||
_lastX = point.Position.X;
|
||||
@ -261,17 +259,17 @@ public partial class DraggableNumberBox : UserControl
|
||||
|
||||
if (args.NewValue < Minimum)
|
||||
{
|
||||
_numberBox.Value = Minimum;
|
||||
NumberBox.Value = Minimum;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.NewValue > Maximum)
|
||||
{
|
||||
_numberBox.Value = Maximum;
|
||||
NumberBox.Value = Maximum;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(Value - _numberBox.Value) > 0.00001)
|
||||
Value = _numberBox.Value;
|
||||
if (Math.Abs(Value - NumberBox.Value) > 0.00001)
|
||||
Value = NumberBox.Value;
|
||||
}
|
||||
}
|
||||
@ -138,8 +138,8 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
|
||||
if (_itemsControl is not null)
|
||||
{
|
||||
for (int i = 0; i < _itemsControl.ItemCount; i++)
|
||||
SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), true);
|
||||
foreach (Control realizedContainer in _itemsControl.GetRealizedContainers())
|
||||
SetDraggingPseudoClasses(realizedContainer, true);
|
||||
}
|
||||
|
||||
if (_dragStarted)
|
||||
@ -147,8 +147,10 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
MoveDraggedItem(_itemsControl, _draggedIndex, _targetIndex);
|
||||
|
||||
if (_itemsControl is not null)
|
||||
for (int i = 0; i < _itemsControl.ItemCount; i++)
|
||||
SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), false);
|
||||
{
|
||||
foreach (Control realizedContainer in _itemsControl.GetRealizedContainers())
|
||||
SetDraggingPseudoClasses(realizedContainer, false);
|
||||
}
|
||||
|
||||
if (_draggedContainer is not null)
|
||||
SetDraggingPseudoClasses(_draggedContainer, false);
|
||||
@ -167,16 +169,8 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
if (itemsControl?.Items is null)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (object? _ in itemsControl.Items)
|
||||
{
|
||||
Control? container = itemsControl.ContainerFromIndex(i);
|
||||
if (container is not null)
|
||||
foreach (Control container in itemsControl.GetRealizedContainers())
|
||||
SetTranslateTransform(container, 0, 0);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveTransforms(ItemsControl? itemsControl)
|
||||
@ -184,16 +178,8 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
if (itemsControl?.Items is null)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (object? _ in itemsControl.Items)
|
||||
{
|
||||
Control? container = itemsControl.ContainerFromIndex(i);
|
||||
if (container is not null)
|
||||
foreach (Control container in itemsControl.GetRealizedContainers())
|
||||
SetTranslateTransform(container, 0, 0);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveDraggedItem(ItemsControl? itemsControl, int draggedIndex, int targetIndex)
|
||||
@ -265,16 +251,10 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
? draggedBounds.X + delta + draggedBounds.Width
|
||||
: draggedBounds.Y + delta + draggedBounds.Height;
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (object? _ in _itemsControl.Items)
|
||||
foreach (Control targetContainer in _itemsControl.GetRealizedContainers())
|
||||
{
|
||||
Control? targetContainer = _itemsControl.ContainerFromIndex(i);
|
||||
if (targetContainer?.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer))
|
||||
{
|
||||
i++;
|
||||
if (targetContainer.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer))
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the target container has children, there are two options
|
||||
// Move into the top of the container
|
||||
@ -287,7 +267,7 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
? targetBounds.X + targetBounds.Width / 2
|
||||
: targetBounds.Y + targetBounds.Height / 2;
|
||||
|
||||
int targetIndex = _itemsControl.ItemContainerGenerator.IndexFromContainer(targetContainer);
|
||||
int targetIndex = _itemsControl.IndexFromContainer(targetContainer);
|
||||
|
||||
if (targetStart > draggedStart && draggedDeltaEnd >= targetMid)
|
||||
{
|
||||
@ -316,8 +296,6 @@ public class TreeItemDragBehavior : Behavior<Control>
|
||||
else
|
||||
SetTranslateTransform(targetContainer, 0, 0);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using System.Reflection;
|
||||
using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.DryIoc.InstanceProviders;
|
||||
using Artemis.UI.Screens;
|
||||
using Artemis.UI.Screens.VisualScripting;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Services.Updating;
|
||||
@ -9,7 +8,6 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.NodeEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Shared.PlatformSupport;
|
||||
using DryIoc;
|
||||
|
||||
namespace Artemis.UI.DryIoc;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<controls:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@ -6,6 +6,7 @@
|
||||
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||
xmlns:debugger="clr-namespace:Artemis.UI.Screens.Debugger"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
|
||||
x:Class="Artemis.UI.Screens.Debugger.DebugView"
|
||||
x:DataType="debugger:DebugViewModel"
|
||||
@ -38,4 +39,4 @@
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</controls:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -10,7 +10,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger;
|
||||
|
||||
public class DebugView : ReactiveAppWindow<DebugViewModel>
|
||||
public partial class DebugView : ReactiveAppWindow<DebugViewModel>
|
||||
{
|
||||
public DebugView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.DataModel;
|
||||
|
||||
public class DataModelDebugView : ReactiveUserControl<DataModelDebugViewModel>
|
||||
public partial class DataModelDebugView : ReactiveUserControl<DataModelDebugViewModel>
|
||||
{
|
||||
public DataModelDebugView()
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView"
|
||||
x:DataType="logs:LogsDebugViewModel">
|
||||
<aedit:TextEditor Name="log"
|
||||
<aedit:TextEditor Name="LogTextEditor"
|
||||
Document="{ CompiledBinding Document }"
|
||||
IsReadOnly="True"
|
||||
FontFamily="Consolas"
|
||||
|
||||
@ -1,20 +1,13 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using AvaloniaEdit;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Logs;
|
||||
|
||||
public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
public partial class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
{
|
||||
private int _lineCount;
|
||||
private TextEditor? _textEditor;
|
||||
|
||||
public LogsDebugView()
|
||||
{
|
||||
@ -25,25 +18,22 @@ public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
_textEditor = this.FindControl<TextEditor>("log");
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
Dispatcher.UIThread.Post(() => _textEditor?.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
}
|
||||
|
||||
private void OnTextChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (_textEditor is null)
|
||||
return;
|
||||
if (_textEditor.ExtentHeight == 0)
|
||||
if (LogTextEditor.ExtentHeight == 0)
|
||||
return;
|
||||
|
||||
int linesAdded = _textEditor.LineCount - _lineCount;
|
||||
double lineHeight = _textEditor.ExtentHeight / _textEditor.LineCount;
|
||||
double outOfScreenTextHeight = _textEditor.ExtentHeight - _textEditor.VerticalOffset - _textEditor.ViewportHeight;
|
||||
int linesAdded = LogTextEditor.LineCount - _lineCount;
|
||||
double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount;
|
||||
double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight;
|
||||
double outOfScreenLines = outOfScreenTextHeight / lineHeight;
|
||||
|
||||
//we need this help distance because of rounding.
|
||||
@ -61,8 +51,8 @@ public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
//mess with anything.
|
||||
if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
_lineCount = _textEditor.LineCount;
|
||||
Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
_lineCount = LogTextEditor.LineCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugPluginView : UserControl
|
||||
public partial class PerformanceDebugPluginView : UserControl
|
||||
{
|
||||
public PerformanceDebugPluginView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugProfilerView : UserControl
|
||||
public partial class PerformanceDebugProfilerView : UserControl
|
||||
{
|
||||
public PerformanceDebugProfilerView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugView : ReactiveUserControl<PerformanceDebugViewModel>
|
||||
public partial class PerformanceDebugView : ReactiveUserControl<PerformanceDebugViewModel>
|
||||
{
|
||||
public PerformanceDebugView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Render;
|
||||
|
||||
public class RenderDebugView : ReactiveUserControl<RenderDebugViewModel>
|
||||
public partial class RenderDebugView : ReactiveUserControl<RenderDebugViewModel>
|
||||
{
|
||||
public RenderDebugView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Settings;
|
||||
|
||||
public class DebugSettingsView : ReactiveUserControl<DebugSettingsViewModel>
|
||||
public partial class DebugSettingsView : ReactiveUserControl<DebugSettingsViewModel>
|
||||
{
|
||||
public DebugSettingsView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceDetectInputView : ReactiveUserControl<DeviceDetectInputViewModel>
|
||||
public partial class DeviceDetectInputView : ReactiveUserControl<DeviceDetectInputViewModel>
|
||||
{
|
||||
public DeviceDetectInputView()
|
||||
{
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<controls1:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
xmlns:device="clr-namespace:Artemis.UI.Screens.Device"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
|
||||
x:Class="Artemis.UI.Screens.Device.DevicePropertiesView"
|
||||
x:DataType="device:DevicePropertiesViewModel"
|
||||
@ -13,9 +13,9 @@
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Width="1250"
|
||||
Height="900">
|
||||
<controls1:CoreWindow.KeyBindings>
|
||||
<windowing:AppWindow.KeyBindings>
|
||||
<KeyBinding Gesture="Escape" Command="{CompiledBinding ClearSelectedLeds}" />
|
||||
</controls1:CoreWindow.KeyBindings>
|
||||
</windowing:AppWindow.KeyBindings>
|
||||
<Grid ColumnDefinitions="*,0,1.5*">
|
||||
<Grid.Background>
|
||||
<VisualBrush TileMode="Tile" Stretch="Uniform" DestinationRect="0,0,25,25">
|
||||
@ -71,5 +71,4 @@
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="3" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
|
||||
</controls1:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -7,7 +7,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DevicePropertiesView : ReactiveAppWindow<DevicePropertiesViewModel>
|
||||
public partial class DevicePropertiesView : ReactiveAppWindow<DevicePropertiesViewModel>
|
||||
{
|
||||
public DevicePropertiesView()
|
||||
{
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
<Grid Grid.Row="2" Margin="10" ColumnDefinitions="25,*">
|
||||
<CheckBox IsChecked="{Binding IsDeviceEnabled}" />
|
||||
|
||||
<controls:SplitButton Grid.Column="1" Content="Properties" Command="{Binding ViewProperties}" HorizontalAlignment="Right">
|
||||
<controls:SplitButton.Flyout>
|
||||
<SplitButton Grid.Column="1" Content="Properties" Command="{Binding ViewProperties}" HorizontalAlignment="Right">
|
||||
<SplitButton.Flyout>
|
||||
<MenuFlyout Placement="Bottom">
|
||||
<MenuItem Header="Open plugin directory" Command="{Binding OpenPluginDirectory}">
|
||||
<MenuItem.Icon>
|
||||
@ -50,8 +50,8 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuFlyout>
|
||||
</controls:SplitButton.Flyout>
|
||||
</controls:SplitButton>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceSettingsView : ReactiveUserControl<DeviceSettingsViewModel>
|
||||
public partial class DeviceSettingsView : ReactiveUserControl<DeviceSettingsViewModel>
|
||||
{
|
||||
public DeviceSettingsView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceInfoTabView : ReactiveUserControl<DeviceInfoTabViewModel>
|
||||
public partial class DeviceInfoTabView : ReactiveUserControl<DeviceInfoTabViewModel>
|
||||
{
|
||||
public DeviceInfoTabView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceLedsTabView : ReactiveUserControl<DeviceLedsTabViewModel>
|
||||
public partial class DeviceLedsTabView : ReactiveUserControl<DeviceLedsTabViewModel>
|
||||
{
|
||||
public DeviceLedsTabView()
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ using Avalonia.Threading;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceLogicalLayoutDialogView : ReactiveUserControl<DeviceLogicalLayoutDialogViewModel>
|
||||
public partial class DeviceLogicalLayoutDialogView : ReactiveUserControl<DeviceLogicalLayoutDialogViewModel>
|
||||
{
|
||||
private readonly AutoCompleteBox _autoCompleteBox;
|
||||
|
||||
@ -16,9 +16,7 @@ public class DeviceLogicalLayoutDialogView : ReactiveUserControl<DeviceLogicalLa
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_autoCompleteBox = this.Get<AutoCompleteBox>("RegionsAutoCompleteBox");
|
||||
_autoCompleteBox.ItemFilter += SearchRegions;
|
||||
|
||||
RegionsAutoCompleteBox.ItemFilter += SearchRegions;
|
||||
Dispatcher.UIThread.InvokeAsync(DelayedAutoFocus);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DevicePhysicalLayoutDialogView : ReactiveUserControl<DevicePhysicalLayoutDialogViewModel>
|
||||
public partial class DevicePhysicalLayoutDialogView : ReactiveUserControl<DevicePhysicalLayoutDialogViewModel>
|
||||
{
|
||||
public DevicePhysicalLayoutDialogView()
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DevicePropertiesTabView : ReactiveUserControl<DevicePropertiesTabViewModel>
|
||||
public partial class DevicePropertiesTabView : ReactiveUserControl<DevicePropertiesTabViewModel>
|
||||
{
|
||||
public DevicePropertiesTabView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class InputMappingsTabView : ReactiveUserControl<InputMappingsTabViewModel>
|
||||
public partial class InputMappingsTabView : ReactiveUserControl<InputMappingsTabViewModel>
|
||||
{
|
||||
public InputMappingsTabView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Home;
|
||||
|
||||
public class HomeView : ReactiveUserControl<HomeViewModel>
|
||||
public partial class HomeView : ReactiveUserControl<HomeViewModel>
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisitesInstallDialogView : ReactiveUserControl<PluginPrerequisitesInstallDialogViewModel>
|
||||
public partial class PluginPrerequisitesInstallDialogView : ReactiveUserControl<PluginPrerequisitesInstallDialogViewModel>
|
||||
{
|
||||
public PluginPrerequisitesInstallDialogView()
|
||||
{
|
||||
|
||||
@ -11,6 +11,7 @@ using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.Core;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using ReactiveUI;
|
||||
using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton;
|
||||
@ -98,7 +99,7 @@ public class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelB
|
||||
|
||||
private async Task ExecuteInstall()
|
||||
{
|
||||
ContentDialogClosingDeferral? deferral = null;
|
||||
Deferral? deferral = null;
|
||||
if (ContentDialog != null)
|
||||
ContentDialog.Closing += (_, args) => deferral = args.GetDeferral();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisitesUninstallDialogView : ReactiveUserControl<PluginPrerequisitesUninstallDialogViewModel>
|
||||
public partial class PluginPrerequisitesUninstallDialogView : ReactiveUserControl<PluginPrerequisitesUninstallDialogViewModel>
|
||||
{
|
||||
public PluginPrerequisitesUninstallDialogView()
|
||||
{
|
||||
|
||||
@ -12,6 +12,7 @@ using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.Core;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using ReactiveUI;
|
||||
using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton;
|
||||
@ -83,7 +84,7 @@ public class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewMode
|
||||
|
||||
private async Task ExecuteUninstall()
|
||||
{
|
||||
ContentDialogClosingDeferral? deferral = null;
|
||||
Deferral? deferral = null;
|
||||
if (ContentDialog != null)
|
||||
ContentDialog.Closing += (_, args) => deferral = args.GetDeferral();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginFeatureView : ReactiveUserControl<PluginFeatureViewModel>
|
||||
public partial class PluginFeatureView : ReactiveUserControl<PluginFeatureViewModel>
|
||||
{
|
||||
public PluginFeatureView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPlatformView : UserControl
|
||||
public partial class PluginPlatformView : UserControl
|
||||
{
|
||||
public PluginPlatformView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisiteActionView : UserControl
|
||||
public partial class PluginPrerequisiteActionView : UserControl
|
||||
{
|
||||
public PluginPrerequisiteActionView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisiteView : ReactiveUserControl<PluginPrerequisiteViewModel>
|
||||
public partial class PluginPrerequisiteView : ReactiveUserControl<PluginPrerequisiteViewModel>
|
||||
{
|
||||
public PluginPrerequisiteView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginSettingsView : ReactiveUserControl<PluginSettingsViewModel>
|
||||
public partial class PluginSettingsView : ReactiveUserControl<PluginSettingsViewModel>
|
||||
{
|
||||
public PluginSettingsView()
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<controls:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Plugins.PluginSettingsWindowView"
|
||||
Icon="/Assets/Images/Logo/application.ico"
|
||||
@ -14,4 +14,4 @@
|
||||
<ContentControl Content="{Binding ConfigurationViewModel}"></ContentControl>
|
||||
<StackPanel Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
|
||||
</Panel>
|
||||
</controls:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -8,7 +8,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginSettingsWindowView : ReactiveAppWindow<PluginSettingsWindowViewModel>
|
||||
public partial class PluginSettingsWindowView : ReactiveAppWindow<PluginSettingsWindowViewModel>
|
||||
{
|
||||
public PluginSettingsWindowView()
|
||||
{
|
||||
|
||||
@ -47,8 +47,8 @@
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SplitButton Content="Settings" Command="{CompiledBinding OpenSettings}">
|
||||
<controls:SplitButton.Flyout>
|
||||
<SplitButton Content="Settings" Command="{CompiledBinding OpenSettings}">
|
||||
<SplitButton.Flyout>
|
||||
<MenuFlyout Placement="Bottom" Opening="FlyoutBase_OnOpening">
|
||||
<MenuItem Header="Open plugin directory" Command="{CompiledBinding OpenPluginDirectory}">
|
||||
<MenuItem.Icon>
|
||||
@ -81,8 +81,8 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuFlyout>
|
||||
</controls:SplitButton.Flyout>
|
||||
</controls:SplitButton>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
|
||||
<controls:HyperlinkButton Classes="icon-button icon-button-large"
|
||||
Margin="5 0"
|
||||
|
||||
@ -7,15 +7,12 @@ using Avalonia.Threading;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginView : ReactiveUserControl<PluginViewModel>
|
||||
public partial class PluginView : ReactiveUserControl<PluginViewModel>
|
||||
{
|
||||
private readonly CheckBox _enabledToggle;
|
||||
|
||||
public PluginView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_enabledToggle = this.Find<CheckBox>("EnabledToggle");
|
||||
_enabledToggle.Click += EnabledToggleOnClick;
|
||||
EnabledToggle.Click += EnabledToggleOnClick;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes;
|
||||
|
||||
public class AlwaysOnConditionView : UserControl
|
||||
public partial class AlwaysOnConditionView : UserControl
|
||||
{
|
||||
public AlwaysOnConditionView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes;
|
||||
|
||||
public class EventConditionView : ReactiveUserControl<EventConditionViewModel>
|
||||
public partial class EventConditionView : ReactiveUserControl<EventConditionViewModel>
|
||||
{
|
||||
public EventConditionView()
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@ -8,7 +9,6 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes;
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes;
|
||||
|
||||
public class PlayOnceConditionView : UserControl
|
||||
public partial class PlayOnceConditionView : UserControl
|
||||
{
|
||||
public PlayOnceConditionView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes;
|
||||
|
||||
public class StaticConditionView : ReactiveUserControl<StaticConditionViewModel>
|
||||
public partial class StaticConditionView : ReactiveUserControl<StaticConditionViewModel>
|
||||
{
|
||||
public StaticConditionView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition;
|
||||
|
||||
public class DisplayConditionScriptView : ReactiveUserControl<DisplayConditionScriptViewModel>
|
||||
public partial class DisplayConditionScriptView : ReactiveUserControl<DisplayConditionScriptViewModel>
|
||||
{
|
||||
public DisplayConditionScriptView()
|
||||
{
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition;
|
||||
|
||||
@ -6,7 +6,7 @@ using Avalonia.VisualTree;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.MenuBar;
|
||||
|
||||
public class MenuBarView : ReactiveUserControl<MenuBarViewModel>
|
||||
public partial class MenuBarView : ReactiveUserControl<MenuBarViewModel>
|
||||
{
|
||||
public MenuBarView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Playback;
|
||||
|
||||
public class PlaybackView : ReactiveUserControl<PlaybackViewModel>
|
||||
public partial class PlaybackView : ReactiveUserControl<PlaybackViewModel>
|
||||
{
|
||||
public PlaybackView()
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
{
|
||||
public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state)
|
||||
{
|
||||
if (e.Source is IControl && sender is TreeView treeView)
|
||||
if (e.Source is Control && sender is TreeView treeView)
|
||||
return Validate<TreeItemViewModel>(treeView, e, sourceContext, targetContext, false);
|
||||
|
||||
return false;
|
||||
@ -24,7 +24,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state)
|
||||
{
|
||||
bool result = false;
|
||||
if (e.Source is IControl && sender is TreeView treeView)
|
||||
if (e.Source is Control && sender is TreeView treeView)
|
||||
result = Validate<TreeItemViewModel>(treeView, e, sourceContext, targetContext, true);
|
||||
|
||||
if (sender is ItemsControl itemsControl)
|
||||
@ -46,8 +46,8 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
private bool Validate<T>(TreeView treeView, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute) where T : TreeItemViewModel
|
||||
{
|
||||
Point position = e.GetPosition(treeView);
|
||||
IVisual? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType<TreeViewItem>();
|
||||
if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not IControl {DataContext: T targetNode})
|
||||
TreeViewItem? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType<TreeViewItem>();
|
||||
if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not Control {DataContext: T targetNode})
|
||||
return false;
|
||||
if (bExecute && targetNode == sourceNode)
|
||||
return false;
|
||||
@ -69,7 +69,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
}
|
||||
else
|
||||
{
|
||||
IVisual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot");
|
||||
Visual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot");
|
||||
if (header != null)
|
||||
{
|
||||
position = e.GetPosition(header);
|
||||
@ -119,7 +119,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDraggingPseudoClasses((IControl) targetVisual, dropType);
|
||||
SetDraggingPseudoClasses(targetVisual, dropType);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -129,12 +129,12 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
{
|
||||
List<TreeViewItem> result = new();
|
||||
|
||||
foreach (ItemContainerInfo containerInfo in currentNode.ItemContainerGenerator.Containers)
|
||||
foreach (Control containerControl in currentNode.GetRealizedContainers())
|
||||
{
|
||||
if (containerInfo.ContainerControl is TreeViewItem treeViewItem && containerInfo.Item is TreeItemViewModel)
|
||||
if (containerControl is TreeViewItem treeViewItem && containerControl.DataContext is TreeItemViewModel)
|
||||
{
|
||||
result.Add(treeViewItem);
|
||||
if (treeViewItem.ItemContainerGenerator.Containers.Any())
|
||||
if (treeViewItem.ItemCount > 0)
|
||||
result.AddRange(GetFlattenedTreeView(treeViewItem));
|
||||
}
|
||||
}
|
||||
@ -142,7 +142,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetDraggingPseudoClasses(IControl control, TreeDropType type)
|
||||
private void SetDraggingPseudoClasses(TreeViewItem control, TreeDropType type)
|
||||
{
|
||||
if (type == TreeDropType.None)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints;
|
||||
|
||||
public class CategoryAdaptionHintView : UserControl
|
||||
public partial class CategoryAdaptionHintView : UserControl
|
||||
{
|
||||
public CategoryAdaptionHintView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints;
|
||||
|
||||
public class DeviceAdaptionHintView : UserControl
|
||||
public partial class DeviceAdaptionHintView : UserControl
|
||||
{
|
||||
public DeviceAdaptionHintView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints;
|
||||
|
||||
public class KeyboardSectionAdaptionHintView : UserControl
|
||||
public partial class KeyboardSectionAdaptionHintView : UserControl
|
||||
{
|
||||
public KeyboardSectionAdaptionHintView()
|
||||
{
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
<controls:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:dialogs="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs"
|
||||
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.LayerHintsDialogView"
|
||||
x:DataType="dialogs:LayerHintsDialogViewModel"
|
||||
@ -68,8 +69,8 @@
|
||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
||||
<Button Grid.Row="0" Grid.Column="0" Command="{Binding AutoDetermineHints}">Auto-determine hints</Button>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Spacing="5">
|
||||
<controls:DropDownButton>
|
||||
<controls:DropDownButton.Flyout>
|
||||
<DropDownButton>
|
||||
<DropDownButton.Flyout>
|
||||
<MenuFlyout Placement="Top">
|
||||
<MenuItem Header="Category hint" Command="{Binding AddCategoryHint}">
|
||||
<MenuItem.Icon>
|
||||
@ -87,12 +88,12 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuFlyout>
|
||||
</controls:DropDownButton.Flyout>
|
||||
</DropDownButton.Flyout>
|
||||
Add hint
|
||||
</controls:DropDownButton>
|
||||
</DropDownButton>
|
||||
<Button Command="{Binding Finish}">Close</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</controls:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs;
|
||||
|
||||
public class LayerHintsDialogView : ReactiveAppWindow<LayerHintsDialogViewModel>
|
||||
public partial class LayerHintsDialogView : ReactiveAppWindow<LayerHintsDialogViewModel>
|
||||
{
|
||||
public LayerHintsDialogView()
|
||||
{
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
|
||||
|
||||
public class FolderTreeItemView : ReactiveUserControl<FolderTreeItemViewModel>
|
||||
public partial class FolderTreeItemView : ReactiveUserControl<FolderTreeItemViewModel>
|
||||
{
|
||||
public FolderTreeItemView()
|
||||
{
|
||||
@ -18,8 +18,8 @@ public class FolderTreeItemView : ReactiveUserControl<FolderTreeItemViewModel>
|
||||
{
|
||||
ViewModel?.Rename.Subscribe(_ =>
|
||||
{
|
||||
this.Get<TextBox>("Input").Focus();
|
||||
this.Get<TextBox>("Input").SelectAll();
|
||||
Input.Focus();
|
||||
Input.SelectAll();
|
||||
}).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
|
||||
|
||||
public class LayerTreeItemView : ReactiveUserControl<LayerTreeItemViewModel>
|
||||
public partial class LayerTreeItemView : ReactiveUserControl<LayerTreeItemViewModel>
|
||||
{
|
||||
public LayerTreeItemView()
|
||||
{
|
||||
@ -18,8 +18,8 @@ public class LayerTreeItemView : ReactiveUserControl<LayerTreeItemViewModel>
|
||||
{
|
||||
ViewModel?.Rename.Subscribe(_ =>
|
||||
{
|
||||
this.Get<TextBox>("Input").Focus();
|
||||
this.Get<TextBox>("Input").SelectAll();
|
||||
Input.Focus();
|
||||
Input.SelectAll();
|
||||
}).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
@ -13,9 +13,8 @@ using Avalonia.VisualTree;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
|
||||
|
||||
public class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
public partial class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
{
|
||||
private readonly TreeView _treeView;
|
||||
private Image? _dragAdorner;
|
||||
private Point _dragStartPosition;
|
||||
private Point _elementDragOffset;
|
||||
@ -23,11 +22,10 @@ public class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
public ProfileTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_treeView = this.Get<TreeView>("ProfileTreeView");
|
||||
|
||||
AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
AddHandler(PointerEnteredEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
}
|
||||
|
||||
private void HandlePointerEnter(object? sender, PointerEventArgs e)
|
||||
@ -122,6 +120,6 @@ public class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
|
||||
private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
_treeView.Focus();
|
||||
ProfileTreeView.Focus();
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.DataBinding;
|
||||
|
||||
public class DataBindingView : ReactiveUserControl<DataBindingViewModel>
|
||||
public partial class DataBindingView : ReactiveUserControl<DataBindingViewModel>
|
||||
{
|
||||
public DataBindingView()
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs;
|
||||
|
||||
public class AddEffectView : ReactiveUserControl<AddEffectViewModel>
|
||||
public partial class AddEffectView : ReactiveUserControl<AddEffectViewModel>
|
||||
{
|
||||
public AddEffectView()
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs;
|
||||
|
||||
public class TimelineSegmentEditView : ReactiveUserControl<TimelineSegmentEditViewModel>
|
||||
public partial class TimelineSegmentEditView : ReactiveUserControl<TimelineSegmentEditViewModel>
|
||||
{
|
||||
public TimelineSegmentEditView()
|
||||
{
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
@ -10,16 +9,11 @@ using Avalonia.VisualTree;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties;
|
||||
|
||||
public class PropertiesView : ReactiveUserControl<PropertiesViewModel>
|
||||
public partial class PropertiesView : ReactiveUserControl<PropertiesViewModel>
|
||||
{
|
||||
private readonly Polygon _timelineCaret;
|
||||
private readonly Line _timelineLine;
|
||||
|
||||
public PropertiesView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_timelineCaret = this.Get<Polygon>("TimelineCaret");
|
||||
_timelineLine = this.Get<Line>("TimelineLine");
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -58,12 +52,12 @@ public class PropertiesView : ReactiveUserControl<PropertiesViewModel>
|
||||
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed || ViewModel == null)
|
||||
return;
|
||||
|
||||
IInputElement? senderElement = (IInputElement?) sender;
|
||||
Visual? senderElement = (Visual?) sender;
|
||||
if (senderElement == null)
|
||||
return;
|
||||
|
||||
// Get the parent grid, need that for our position
|
||||
IVisual? parent = senderElement.VisualParent;
|
||||
Visual? parent = senderElement.GetVisualParent();
|
||||
double x = Math.Max(0, e.GetPosition(parent).X);
|
||||
TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond);
|
||||
newTime = RoundTime(newTime);
|
||||
@ -84,11 +78,11 @@ public class PropertiesView : ReactiveUserControl<PropertiesViewModel>
|
||||
|
||||
private void TimelineHeader_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || sender is not IInputElement senderElement)
|
||||
if (ViewModel == null || sender is not Visual senderElement)
|
||||
return;
|
||||
|
||||
// Get the parent grid, need that for our position
|
||||
double x = Math.Max(0, e.GetPosition(senderElement.VisualParent).X);
|
||||
double x = Math.Max(0, e.GetPosition(senderElement.GetVisualParent()).X);
|
||||
TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond);
|
||||
|
||||
ViewModel.TimelineViewModel.ChangeTime(RoundTime(newTime));
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
|
||||
|
||||
public class TimelineEasingView : UserControl
|
||||
public partial class TimelineEasingView : UserControl
|
||||
{
|
||||
public TimelineEasingView()
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
|
||||
|
||||
public class TimelineKeyframeView : ReactiveUserControl<ITimelineKeyframeViewModel>
|
||||
public partial class TimelineKeyframeView : ReactiveUserControl<ITimelineKeyframeViewModel>
|
||||
{
|
||||
private bool _moved;
|
||||
private TimelinePropertyView? _timelinePropertyView;
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@ -13,7 +14,6 @@ using Artemis.UI.Shared.Extensions;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Input;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
|
||||
@ -6,15 +6,13 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
|
||||
|
||||
public class EndSegmentView : ReactiveUserControl<EndSegmentViewModel>
|
||||
public partial class EndSegmentView : ReactiveUserControl<EndSegmentViewModel>
|
||||
{
|
||||
private readonly Rectangle _keyframeDragAnchor;
|
||||
private double _dragOffset;
|
||||
|
||||
public EndSegmentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_keyframeDragAnchor = this.Get<Rectangle>("KeyframeDragAnchor");
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -26,7 +24,7 @@ public class EndSegmentView : ReactiveUserControl<EndSegmentViewModel>
|
||||
{
|
||||
if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
||||
return;
|
||||
e.Pointer.Capture(_keyframeDragAnchor);
|
||||
e.Pointer.Capture(KeyframeDragAnchor);
|
||||
|
||||
_dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X;
|
||||
ViewModel.StartResize();
|
||||
@ -34,14 +32,14 @@ public class EndSegmentView : ReactiveUserControl<EndSegmentViewModel>
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
}
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
e.Pointer.Capture(null);
|
||||
ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
|
||||
|
||||
@ -6,15 +6,13 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
|
||||
|
||||
public class MainSegmentView : ReactiveUserControl<MainSegmentViewModel>
|
||||
public partial class MainSegmentView : ReactiveUserControl<MainSegmentViewModel>
|
||||
{
|
||||
private readonly Rectangle _keyframeDragAnchor;
|
||||
private double _dragOffset;
|
||||
|
||||
public MainSegmentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_keyframeDragAnchor = this.Get<Rectangle>("KeyframeDragAnchor");
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -26,7 +24,7 @@ public class MainSegmentView : ReactiveUserControl<MainSegmentViewModel>
|
||||
{
|
||||
if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
||||
return;
|
||||
e.Pointer.Capture(_keyframeDragAnchor);
|
||||
e.Pointer.Capture(KeyframeDragAnchor);
|
||||
|
||||
_dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X;
|
||||
ViewModel.StartResize();
|
||||
@ -34,14 +32,14 @@ public class MainSegmentView : ReactiveUserControl<MainSegmentViewModel>
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
}
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
e.Pointer.Capture(null);
|
||||
ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
|
||||
|
||||
@ -6,15 +6,13 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
|
||||
|
||||
public class StartSegmentView : ReactiveUserControl<StartSegmentViewModel>
|
||||
public partial class StartSegmentView : ReactiveUserControl<StartSegmentViewModel>
|
||||
{
|
||||
private readonly Rectangle _keyframeDragAnchor;
|
||||
private double _dragOffset;
|
||||
|
||||
public StartSegmentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_keyframeDragAnchor = this.Get<Rectangle>("KeyframeDragAnchor");
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -26,7 +24,7 @@ public class StartSegmentView : ReactiveUserControl<StartSegmentViewModel>
|
||||
{
|
||||
if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
||||
return;
|
||||
e.Pointer.Capture(_keyframeDragAnchor);
|
||||
e.Pointer.Capture(KeyframeDragAnchor);
|
||||
|
||||
_dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X;
|
||||
ViewModel.StartResize();
|
||||
@ -34,14 +32,14 @@ public class StartSegmentView : ReactiveUserControl<StartSegmentViewModel>
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
}
|
||||
|
||||
private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor))
|
||||
if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor))
|
||||
return;
|
||||
e.Pointer.Capture(null);
|
||||
ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Services;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
||||
|
||||
public class TimelineGroupView : ReactiveUserControl<TimelineGroupViewModel>
|
||||
public partial class TimelineGroupView : ReactiveUserControl<TimelineGroupViewModel>
|
||||
{
|
||||
public TimelineGroupView()
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive.Disposables;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
||||
|
||||
public class TimelinePropertyView : ReactiveUserControl<ITimelinePropertyViewModel>
|
||||
public partial class TimelinePropertyView : ReactiveUserControl<ITimelinePropertyViewModel>
|
||||
{
|
||||
public TimelinePropertyView()
|
||||
{
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
|
||||
|
||||
@ -9,17 +9,15 @@ using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
||||
|
||||
public class TimelineView : ReactiveUserControl<TimelineViewModel>
|
||||
public partial class TimelineView : ReactiveUserControl<TimelineViewModel>
|
||||
{
|
||||
private readonly SelectionRectangle _selectionRectangle;
|
||||
|
||||
public TimelineView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_selectionRectangle = this.Get<SelectionRectangle>("SelectionRectangle");
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -34,7 +32,8 @@ public class TimelineView : ReactiveUserControl<TimelineViewModel>
|
||||
|
||||
List<TimelineKeyframeView> keyframeViews = this.GetVisualChildrenOfType<TimelineKeyframeView>().Where(k =>
|
||||
{
|
||||
Rect hitTestRect = k.TransformedBounds != null ? k.TransformedBounds.Value.Bounds.TransformToAABB(k.TransformedBounds.Value.Transform) : Rect.Empty;
|
||||
TransformedBounds? transformedBounds = k.GetTransformedBounds();
|
||||
Rect hitTestRect = transformedBounds != null ? transformedBounds.Value.Bounds.TransformToAABB(transformedBounds.Value.Transform) : new Rect();
|
||||
return e.AbsoluteRectangle.Intersects(hitTestRect);
|
||||
}).ToList();
|
||||
|
||||
@ -43,7 +42,7 @@ public class TimelineView : ReactiveUserControl<TimelineViewModel>
|
||||
|
||||
private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (_selectionRectangle.IsSelecting)
|
||||
if (SelectionRectangle.IsSelecting)
|
||||
return;
|
||||
|
||||
ViewModel?.SelectKeyframes(new List<ITimelineKeyframeViewModel>(), false);
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@ -14,7 +15,6 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Extensions;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Shared.Extensions;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
@ -8,7 +7,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.ContentDialogs;
|
||||
|
||||
public class LayerEffectRenameView : ReactiveUserControl<LayerEffectRenameViewModel>
|
||||
public partial class LayerEffectRenameView : ReactiveUserControl<LayerEffectRenameViewModel>
|
||||
{
|
||||
public LayerEffectRenameView()
|
||||
{
|
||||
@ -24,8 +23,8 @@ public class LayerEffectRenameView : ReactiveUserControl<LayerEffectRenameViewMo
|
||||
{
|
||||
// Don't ask
|
||||
await Task.Delay(200);
|
||||
this.Get<TextBox>("NameTextBox").SelectAll();
|
||||
this.Get<TextBox>("NameTextBox").Focus();
|
||||
NameTextBox.SelectAll();
|
||||
NameTextBox.Focus();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
||||
@ -6,7 +6,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.Dialogs;
|
||||
|
||||
public class LayerBrushPresetView : ReactiveUserControl<LayerBrushPresetViewModel>
|
||||
public partial class LayerBrushPresetView : ReactiveUserControl<LayerBrushPresetViewModel>
|
||||
{
|
||||
public LayerBrushPresetView()
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
||||
|
||||
public class TreeGroupView : ReactiveUserControl<TreeGroupViewModel>
|
||||
public partial class TreeGroupView : ReactiveUserControl<TreeGroupViewModel>
|
||||
{
|
||||
public TreeGroupView()
|
||||
{
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
@ -11,7 +10,7 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
||||
|
||||
public class TreePropertyView : ReactiveUserControl<ITreePropertyViewModel>
|
||||
public partial class TreePropertyView : ReactiveUserControl<ITreePropertyViewModel>
|
||||
{
|
||||
public TreePropertyView()
|
||||
{
|
||||
@ -32,6 +31,6 @@ public class TreePropertyView : ReactiveUserControl<ITreePropertyViewModel>
|
||||
private void DataBindingToggleButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel?.ToggleCurrentLayerProperty();
|
||||
this.Find<ToggleButton>("DataBindingToggleButton").IsChecked = !this.Find<ToggleButton>("DataBindingToggleButton").IsChecked;
|
||||
DataBindingToggleButton.IsChecked = !DataBindingToggleButton.IsChecked;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Extensions;
|
||||
@ -7,7 +8,6 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Artemis.UI.Shared.Services.PropertyInput;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<controls:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
@ -15,4 +15,4 @@
|
||||
<Panel>
|
||||
<ContentControl Content="{Binding ConfigurationViewModel}" />
|
||||
</Panel>
|
||||
</controls:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows;
|
||||
|
||||
public class BrushConfigurationWindowView : ReactiveAppWindow<BrushConfigurationWindowViewModel>
|
||||
public partial class BrushConfigurationWindowView : ReactiveAppWindow<BrushConfigurationWindowViewModel>
|
||||
{
|
||||
private bool _canClose;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<controls:CoreWindow xmlns="https://github.com/avaloniaui"
|
||||
<windowing:AppWindow xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
@ -15,4 +15,4 @@
|
||||
<Panel>
|
||||
<ContentControl Content="{Binding ConfigurationViewModel}" />
|
||||
</Panel>
|
||||
</controls:CoreWindow>
|
||||
</windowing:AppWindow>
|
||||
@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows;
|
||||
|
||||
public class EffectConfigurationWindowView : ReactiveAppWindow<EffectConfigurationWindowViewModel>
|
||||
public partial class EffectConfigurationWindowView : ReactiveAppWindow<EffectConfigurationWindowViewModel>
|
||||
{
|
||||
private bool _canClose;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.StatusBar;
|
||||
|
||||
public class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||
public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||
{
|
||||
public StatusBarView()
|
||||
{
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.StatusBar;
|
||||
|
||||
@ -6,7 +6,7 @@ using Avalonia.Skia;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools;
|
||||
|
||||
public class SelectionAddToolView : ReactiveUserControl<SelectionAddToolViewModel>
|
||||
public partial class SelectionAddToolView : ReactiveUserControl<SelectionAddToolViewModel>
|
||||
{
|
||||
public SelectionAddToolView()
|
||||
{
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Material.Icons;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -5,7 +5,7 @@ using Avalonia.Skia;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools;
|
||||
|
||||
public class SelectionRemoveToolView : ReactiveUserControl<SelectionRemoveToolViewModel>
|
||||
public partial class SelectionRemoveToolView : ReactiveUserControl<SelectionRemoveToolViewModel>
|
||||
{
|
||||
public SelectionRemoveToolView()
|
||||
{
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Material.Icons;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Extensions;
|
||||
using Avalonia;
|
||||
@ -21,19 +22,9 @@ using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools;
|
||||
|
||||
public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
public partial class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
{
|
||||
private readonly Grid _handleGrid;
|
||||
private readonly List<Control> _handles = new();
|
||||
private readonly Panel _resizeBottomCenter;
|
||||
private readonly Panel _resizeBottomLeft;
|
||||
private readonly Panel _resizeBottomRight;
|
||||
private readonly Panel _resizeLeftCenter;
|
||||
private readonly Panel _resizeRightCenter;
|
||||
private readonly Panel _resizeTopCenter;
|
||||
private readonly Panel _resizeTopLeft;
|
||||
private readonly Panel _resizeTopRight;
|
||||
|
||||
private SKPoint _dragOffset;
|
||||
private ZoomBorder? _zoomBorder;
|
||||
|
||||
@ -41,31 +32,21 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_handleGrid = this.Get<Grid>("HandleGrid");
|
||||
_handles.Add(RotateTopLeft);
|
||||
_handles.Add(RotateTopRight);
|
||||
_handles.Add(RotateBottomRight);
|
||||
_handles.Add(RotateBottomLeft);
|
||||
|
||||
_handles.Add(this.Get<Ellipse>("RotateTopLeft"));
|
||||
_handles.Add(this.Get<Ellipse>("RotateTopRight"));
|
||||
_handles.Add(this.Get<Ellipse>("RotateBottomRight"));
|
||||
_handles.Add(this.Get<Ellipse>("RotateBottomLeft"));
|
||||
_handles.Add(ResizeTopCenter);
|
||||
_handles.Add(ResizeRightCenter);
|
||||
_handles.Add(ResizeBottomCenter);
|
||||
_handles.Add(ResizeLeftCenter);
|
||||
_handles.Add(ResizeTopLeft);
|
||||
_handles.Add(ResizeTopRight);
|
||||
_handles.Add(ResizeBottomRight);
|
||||
_handles.Add(ResizeBottomLeft);
|
||||
|
||||
_resizeTopCenter = this.Get<Panel>("ResizeTopCenter");
|
||||
_handles.Add(_resizeTopCenter);
|
||||
_resizeRightCenter = this.Get<Panel>("ResizeRightCenter");
|
||||
_handles.Add(_resizeRightCenter);
|
||||
_resizeBottomCenter = this.Get<Panel>("ResizeBottomCenter");
|
||||
_handles.Add(_resizeBottomCenter);
|
||||
_resizeLeftCenter = this.Get<Panel>("ResizeLeftCenter");
|
||||
_handles.Add(_resizeLeftCenter);
|
||||
_resizeTopLeft = this.Get<Panel>("ResizeTopLeft");
|
||||
_handles.Add(_resizeTopLeft);
|
||||
_resizeTopRight = this.Get<Panel>("ResizeTopRight");
|
||||
_handles.Add(_resizeTopRight);
|
||||
_resizeBottomRight = this.Get<Panel>("ResizeBottomRight");
|
||||
_handles.Add(_resizeBottomRight);
|
||||
_resizeBottomLeft = this.Get<Panel>("ResizeBottomLeft");
|
||||
_handles.Add(_resizeBottomLeft);
|
||||
|
||||
_handles.Add(this.Get<Panel>("AnchorPoint"));
|
||||
_handles.Add(AnchorPoint);
|
||||
|
||||
this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Rotation).Subscribe(_ => UpdateTransforms()).DisposeWith(d));
|
||||
}
|
||||
@ -83,10 +64,10 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
RotateTransform counterRotate = new(ViewModel.Rotation * -1);
|
||||
|
||||
// Apply the counter rotation to the containers
|
||||
foreach (Panel panel in _handleGrid.Children.Where(c => c is Panel and not Canvas).Cast<Panel>())
|
||||
foreach (Panel panel in HandleGrid.Children.Where(c => c is Panel and not Canvas).Cast<Panel>())
|
||||
panel.RenderTransform = counterRotate;
|
||||
|
||||
foreach (Control control in _handleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast<Control>())
|
||||
foreach (Control control in HandleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast<Control>())
|
||||
control.RenderTransform = counterScale;
|
||||
}
|
||||
|
||||
@ -117,21 +98,21 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
|
||||
private TransformToolViewModel.ResizeSide GetResizeDirection(Ellipse element)
|
||||
{
|
||||
if (ReferenceEquals(element.Parent, _resizeTopLeft))
|
||||
if (ReferenceEquals(element.Parent, ResizeTopLeft))
|
||||
return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Left;
|
||||
if (ReferenceEquals(element.Parent, _resizeTopRight))
|
||||
if (ReferenceEquals(element.Parent, ResizeTopRight))
|
||||
return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Right;
|
||||
if (ReferenceEquals(element.Parent, _resizeBottomRight))
|
||||
if (ReferenceEquals(element.Parent, ResizeBottomRight))
|
||||
return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Right;
|
||||
if (ReferenceEquals(element.Parent, _resizeBottomLeft))
|
||||
if (ReferenceEquals(element.Parent, ResizeBottomLeft))
|
||||
return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Left;
|
||||
if (ReferenceEquals(element.Parent, _resizeTopCenter))
|
||||
if (ReferenceEquals(element.Parent, ResizeTopCenter))
|
||||
return TransformToolViewModel.ResizeSide.Top;
|
||||
if (ReferenceEquals(element.Parent, _resizeRightCenter))
|
||||
if (ReferenceEquals(element.Parent, ResizeRightCenter))
|
||||
return TransformToolViewModel.ResizeSide.Right;
|
||||
if (ReferenceEquals(element.Parent, _resizeBottomCenter))
|
||||
if (ReferenceEquals(element.Parent, ResizeBottomCenter))
|
||||
return TransformToolViewModel.ResizeSide.Bottom;
|
||||
if (ReferenceEquals(element.Parent, _resizeLeftCenter))
|
||||
if (ReferenceEquals(element.Parent, ResizeLeftCenter))
|
||||
return TransformToolViewModel.ResizeSide.Left;
|
||||
|
||||
throw new ArgumentException("Given element is not a child of a resize container");
|
||||
@ -310,14 +291,14 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
|
||||
|
||||
private void UpdateCursors()
|
||||
{
|
||||
_resizeTopCenter.Cursor = GetCursorAtAngle(0f);
|
||||
_resizeTopRight.Cursor = GetCursorAtAngle(45f);
|
||||
_resizeRightCenter.Cursor = GetCursorAtAngle(90f);
|
||||
_resizeBottomRight.Cursor = GetCursorAtAngle(135f);
|
||||
_resizeBottomCenter.Cursor = GetCursorAtAngle(180f);
|
||||
_resizeBottomLeft.Cursor = GetCursorAtAngle(225f);
|
||||
_resizeLeftCenter.Cursor = GetCursorAtAngle(270f);
|
||||
_resizeTopLeft.Cursor = GetCursorAtAngle(315f);
|
||||
ResizeTopCenter.Cursor = GetCursorAtAngle(0f);
|
||||
ResizeTopRight.Cursor = GetCursorAtAngle(45f);
|
||||
ResizeRightCenter.Cursor = GetCursorAtAngle(90f);
|
||||
ResizeBottomRight.Cursor = GetCursorAtAngle(135f);
|
||||
ResizeBottomCenter.Cursor = GetCursorAtAngle(180f);
|
||||
ResizeBottomLeft.Cursor = GetCursorAtAngle(225f);
|
||||
ResizeLeftCenter.Cursor = GetCursorAtAngle(270f);
|
||||
ResizeTopLeft.Cursor = GetCursorAtAngle(315f);
|
||||
}
|
||||
|
||||
private Cursor GetCursorAtAngle(float angle, bool includeLayerRotation = true)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Exceptions;
|
||||
@ -7,7 +8,6 @@ using Artemis.UI.Shared.Extensions;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Material.Icons;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -2,7 +2,6 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.PanAndZoom;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
@ -13,19 +12,17 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor;
|
||||
|
||||
public class VisualEditorView : ReactiveUserControl<VisualEditorViewModel>
|
||||
public partial class VisualEditorView : ReactiveUserControl<VisualEditorViewModel>
|
||||
{
|
||||
private readonly ZoomBorder _zoomBorder;
|
||||
private bool _movedByUser;
|
||||
|
||||
public VisualEditorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_zoomBorder = this.Find<ZoomBorder>("ZoomBorder");
|
||||
_zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
|
||||
_zoomBorder.PointerMoved += ZoomBorderOnPointerMoved;
|
||||
_zoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged;
|
||||
ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
|
||||
ZoomBorder.PointerMoved += ZoomBorderOnPointerMoved;
|
||||
ZoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged;
|
||||
UpdateZoomBorderBackground();
|
||||
|
||||
this.WhenActivated(d =>
|
||||
@ -48,7 +45,7 @@ public class VisualEditorView : ReactiveUserControl<VisualEditorViewModel>
|
||||
|
||||
private void ZoomBorderOnPointerMoved(object? sender, PointerEventArgs e)
|
||||
{
|
||||
if (e.GetCurrentPoint(_zoomBorder).Properties.IsMiddleButtonPressed)
|
||||
if (e.GetCurrentPoint(ZoomBorder).Properties.IsMiddleButtonPressed)
|
||||
_movedByUser = true;
|
||||
}
|
||||
|
||||
@ -59,14 +56,14 @@ public class VisualEditorView : ReactiveUserControl<VisualEditorViewModel>
|
||||
|
||||
private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.Property.Name == nameof(_zoomBorder.Background))
|
||||
if (e.Property.Name == nameof(ZoomBorder.Background))
|
||||
UpdateZoomBorderBackground();
|
||||
}
|
||||
|
||||
private void UpdateZoomBorderBackground()
|
||||
{
|
||||
if (_zoomBorder.Background is VisualBrush visualBrush)
|
||||
visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute);
|
||||
if (ZoomBorder.Background is VisualBrush visualBrush)
|
||||
visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@ -96,8 +93,8 @@ public class VisualEditorView : ReactiveUserControl<VisualEditorViewModel>
|
||||
double scale = Math.Min(3, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height));
|
||||
|
||||
// Pan and zoom to make the script fit
|
||||
_zoomBorder.Zoom(scale, 0, 0, skipTransitions);
|
||||
_zoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions);
|
||||
ZoomBorder.Zoom(scale, 0, 0, skipTransitions);
|
||||
ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions);
|
||||
|
||||
_movedByUser = false;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Controls.PanAndZoom;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.LogicalTree;
|
||||
@ -12,18 +12,13 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Visualizers;
|
||||
|
||||
public class LayerShapeVisualizerView : ReactiveUserControl<LayerShapeVisualizerViewModel>
|
||||
public partial class LayerShapeVisualizerView : ReactiveUserControl<LayerShapeVisualizerViewModel>
|
||||
{
|
||||
private readonly Path _layerVisualizer;
|
||||
private readonly Path _layerVisualizerUnbound;
|
||||
private ZoomBorder? _zoomBorder;
|
||||
|
||||
public LayerShapeVisualizerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_layerVisualizer = this.Get<Path>("LayerVisualizer");
|
||||
_layerVisualizerUnbound = this.Get<Path>("LayerVisualizerUnbound");
|
||||
|
||||
this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Selected).Subscribe(_ => UpdateStrokeThickness()).DisposeWith(d));
|
||||
}
|
||||
|
||||
@ -66,13 +61,13 @@ public class LayerShapeVisualizerView : ReactiveUserControl<LayerShapeVisualizer
|
||||
|
||||
if (ViewModel != null && ViewModel.Selected)
|
||||
{
|
||||
_layerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX);
|
||||
_layerVisualizerUnbound.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX);
|
||||
LayerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX);
|
||||
LayerVisualizerUnbound.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX);
|
||||
}
|
||||
else
|
||||
{
|
||||
_layerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX) / 2;
|
||||
_layerVisualizerUnbound.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX) / 2;
|
||||
LayerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX) / 2;
|
||||
LayerVisualizerUnbound.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user