Fixed remaining compile errors

This commit is contained in:
Robert committed 2023-03-31 20:52:44 +02:00
1 parent d171b947b7
commit 5b5acf2f76
96 files changed
+167 -583

No files matched your search

@@ -9,7 +9,6 @@
<TextBlock Classes="subtitle" Text="{Binding Profiler.Name}" Margin="10 10 0 0" />
<DataGrid Items="{Binding Measurements}"
d:DataContext="{d:DesignInstance Type={x:Type local:PerformanceDebugMeasurementViewModel}}"
CanUserSortColumns="True"
IsReadOnly="True"
AutoGenerateColumns="False"
+1 -1
View File
@@ -117,7 +117,7 @@
</controls:HyperlinkButton>
<TextBlock Grid.Row="1"
Grid.Column="1"
Foreground="{DynamicResource MaterialDesignBodyLight}"
Classes="subtitle"
TextWrapping="Wrap"
VerticalAlignment="Center">
Feel like making a donation? It would be gratefully received. Click the button to donate via PayPal.
@@ -18,7 +18,7 @@
<TextBlock Text=" - " />
<TextBlock Text="{CompiledBinding ActiveAction.Action.Name, Mode=OneWay, FallbackValue=''}" />
</StackPanel>
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}" TextWrapping="Wrap" IsVisible="{CompiledBinding Actions.Count}">
<TextBlock Classes="subtitle" TextWrapping="Wrap" IsVisible="{CompiledBinding Actions.Count}">
</TextBlock>
<TextBlock Classes="h4" TextWrapping="Wrap" Text="{CompiledBinding ActiveAction.Action.Name, Mode=OneWay}" IsVisible="{CompiledBinding !Actions.Count}" />
@@ -1,5 +1,4 @@
using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -13,7 +13,6 @@ using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.Builders;
using Avalonia.Controls;
using Avalonia.Threading;
using DryIoc;
using Material.Icons;
using ReactiveUI;
@@ -3,7 +3,6 @@ using System.Collections.ObjectModel;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Generators;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
@@ -1,6 +1,5 @@
using System;
using System.Reactive.Disposables;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
@@ -1,6 +1,5 @@
using System;
using System.Reactive.Disposables;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
@@ -23,8 +23,8 @@
<converters:ColorOpacityConverter x:Key="ColorOpacityConverter" />
</UserControl.Resources>
<UserControl.Styles>
<StyleInclude Source="avares://Avalonia.Xaml.Interactions/Draggable/Styles.axaml" />
<Style Selector="TreeView#ProfileTreeView">
<StyleInclude Source="avares://Avalonia.Xaml.Interactions.Draggable/Styles.axaml" />
<Style Selector="TreeView#Profile">
<Style.Resources>
<profileBehaviors:ProfileTreeViewDropHandler x:Key="ProfileTreeViewDropHandler" />
</Style.Resources>
@@ -37,7 +37,7 @@
</Setter>
</Style>
<Style Selector="TreeView#ProfileTreeView TreeViewItem">
<Style Selector="TreeView#Profile TreeViewItem">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="(Interaction.Behaviors)">
<BehaviorCollectionTemplate>
@@ -48,7 +48,7 @@
</Setter>
</Style>
<Style Selector="TreeView#ProfileTreeView TreeViewItem:dragging-before">
<Style Selector="TreeView#Profile TreeViewItem:dragging-before">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,28">
@@ -60,7 +60,7 @@
</Setter.Value>
</Setter>
</Style>
<Style Selector="TreeView#ProfileTreeView TreeViewItem:dragging-into">
<Style Selector="TreeView#Profile TreeViewItem:dragging-into">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,28">
@@ -76,7 +76,7 @@
</Setter.Value>
</Setter>
</Style>
<Style Selector="TreeView#ProfileTreeView TreeViewItem:dragging-after">
<Style Selector="TreeView#Profile TreeViewItem:dragging-after">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,28">
@@ -90,7 +90,7 @@
</Style>
</UserControl.Styles>
<Grid RowDefinitions="*,Auto">
<TreeView Name="ProfileTreeView" Classes="no-right-margin draggable"
<TreeView Name="Profile" Classes="no-right-margin draggable"
Items="{CompiledBinding Children}"
SelectedItem="{CompiledBinding SelectedChild}"
SelectionChanged="ProfileTreeView_OnSelectionChanged">
@@ -120,6 +120,6 @@ public partial class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
ProfileTreeView.Focus();
Profile.Focus();
}
}
@@ -1,5 +1,3 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -1,5 +1,3 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -1,5 +1,3 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -5,7 +5,6 @@ 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;
@@ -12,7 +12,6 @@ using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.Builders;
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;
@@ -1,11 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Events;
using Artemis.UI.Shared.Extensions;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -6,7 +6,6 @@ using Artemis.Core;
using Artemis.UI.Shared.Extensions;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Mixins;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
@@ -2,9 +2,7 @@ using System;
using System.Linq;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Controls.Shapes;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -1,9 +1,7 @@
using System;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Controls.Shapes;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
namespace Artemis.UI.Screens.ProfileEditor;
@@ -8,8 +8,7 @@
xmlns:shared="clr-namespace:Artemis.UI.Shared.Services.ProfileEditor;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileEditorView"
x:DataType="profileEditor:ProfileEditorViewModel"
Name="ProfileEditorView">
x:DataType="profileEditor:ProfileEditorViewModel">
<UserControl.Resources>
<converters:DoubleToGridLengthConverter x:Key="DoubleToGridLengthConverter" />
</UserControl.Resources>
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -29,7 +29,7 @@
<TextBlock Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top"
Foreground="{DynamicResource MaterialDesignBodyLight}"
Classes="subtitle"
Text="{Binding Version}" />
<controls:HyperlinkButton Grid.Row="1"
@@ -14,7 +14,7 @@
<ColumnDefinition MinWidth="165" MaxWidth="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Classes="clearButton" Text="{CompiledBinding SearchPluginInput}" Watermark="Search plugins" Margin="0 0 10 0" />
<TextBox Classes="clearButton" Text="{CompiledBinding SearchPluginInput}" Watermark="Search plugins" Margin="0 0 10 0" />
<StackPanel Spacing="5" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<controls:HyperlinkButton VerticalAlignment="Top" NavigateUri="https://wiki.artemis-rgb.com/en/guides/user/plugins">
@@ -157,166 +157,7 @@
<Separator Grid.Row="1" Classes="card-separator" />
<avalonia:MarkdownScrollViewer Grid.Row="2" Markdown="{CompiledBinding Changelog}">
<avalonia:MarkdownScrollViewer.Styles>
<Style Selector="ctxt|CTextBlock">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 1}" />
<Setter Property="Margin" Value="0,5" />
</Style.Setters>
</Style>
<Style Selector="TextBlock">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 1}" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.Heading1">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 3.2}" />
<Setter Property="Foreground" Value="{mde:Alpha TextFillColorPrimaryBrush}" />
<Setter Property="FontWeight" Value="Light" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.Heading2">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 1.6}" />
<Setter Property="Foreground" Value="{mde:Alpha TextFillColorPrimaryBrush}" />
<Setter Property="FontWeight" Value="Light" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.Heading3">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 1.6}" />
<Setter Property="Foreground" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.7}" />
<Setter Property="FontWeight" Value="Light" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.Heading4">
<Style.Setters>
<Setter Property="FontSize" Value="{mde:Multiply ControlContentThemeFontSize, 1.2}" />
<Setter Property="Foreground" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.7}" />
<Setter Property="FontWeight" Value="Light" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CHyperlink">
<Style.Setters>
<Setter Property="IsUnderline" Value="true" />
<Setter Property="Foreground" Value="{StaticResource SystemAccentColor}" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CHyperlink:pointerover">
<Setter Property="Foreground" Value="{mde:Complementary SystemAccentColor}" />
</Style>
<Style Selector="Border.Table">
<Style.Setters>
<Setter Property="Margin" Value="5" />
<Setter Property="BorderThickness" Value="0,0,1,1" />
<Setter Property="BorderBrush" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.7}" />
</Style.Setters>
</Style>
<Style Selector="Grid.Table > Border">
<Style.Setters>
<Setter Property="Margin" Value="0" />
<Setter Property="BorderThickness" Value="1,1,0,0" />
<Setter Property="BorderBrush" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.7}" />
<Setter Property="Padding" Value="2" />
</Style.Setters>
</Style>
<Style Selector="Border.TableHeader">
<Style.Setters>
<Setter Property="Background" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.3}" />
</Style.Setters>
</Style>
<Style Selector="Border.TableHeader ctxt|CTextBlock">
<Style.Setters>
<Setter Property="FontWeight" Value="DemiBold" />
</Style.Setters>
</Style>
<Style Selector="Border.EvenTableRow">
<Style.Setters>
<Setter Property="Background" Value="{mde:Alpha ControlFillColorDefaultBrush, 0.9}" />
</Style.Setters>
</Style>
<Style Selector="Border.CodeBlock">
<Style.Setters>
<Setter Property="BorderBrush" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.2}" />
<Setter Property="BorderThickness" Value="0,5,0,5" />
<Setter Property="Margin" Value="5,0,5,0" />
<Setter Property="Background" Value="{mde:Alpha ControlFillColorDefaultBrush, 0.9}" />
</Style.Setters>
</Style>
<Style Selector="TextBlock.CodeBlock">
<Style.Setters>
<Setter Property="FontFamily" Value="menlo,monaco,consolas,droid sans mono,inconsolata,courier new,monospace,dejavu sans mono" />
<Setter Property="Foreground" Value="{mde:DivideColor Blue, TextFillColorPrimary, 0.4}" />
</Style.Setters>
</Style>
<Style Selector="Border.NoContainer">
<Style.Setters>
<Setter Property="BorderBrush" Value="Red" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CCode">
<Style.Setters>
<Setter Property="Foreground" Value="{mde:DivideColor Blue, TextFillColorPrimary, 0.4}" />
<Setter Property="Background" Value="{mde:Alpha ControlFillColorDefaultBrush, 0.9}" />
</Style.Setters>
</Style>
<Style Selector="Border.Note">
<Style.Setters>
<Setter Property="Margin" Value="5,0,5,0" />
<Setter Property="BorderBrush" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.2}" />
<Setter Property="BorderThickness" Value="3,3,3,3" />
<Setter Property="Background" Value="{mde:Alpha ControlFillColorDefaultBrush, 0.9}" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.Note">
<Style.Setters>
<Setter Property="Margin" Value="10, 5" />
</Style.Setters>
</Style>
<Style Selector="Grid.List">
<Style.Setters>
<Setter Property="Margin" Value="15,0,0,0" />
</Style.Setters>
</Style>
<Style Selector="ctxt|CTextBlock.ListMarker">
<Style.Setters>
<Setter Property="Margin" Value="0,5,5,5" />
</Style.Setters>
</Style>
<Style Selector="Border.Blockquote">
<Style.Setters>
<Setter Property="BorderBrush" Value="{mde:Alpha TextFillColorPrimaryBrush, 0.2}" />
<Setter Property="BorderThickness" Value="5,0,0,0" />
</Style.Setters>
</Style>
<Style Selector="StackPanel.Blockquote">
<Style.Setters>
<Setter Property="Margin" Value="10, 5" />
</Style.Setters>
</Style>
<Style Selector="mdc|Rule">
<Style.Setters>
<Setter Property="Margin" Value="0,3" />
</Style.Setters>
</Style>
</avalonia:MarkdownScrollViewer.Styles>
</avalonia:MarkdownScrollViewer>
</Grid>
</Border>
@@ -1,6 +1,5 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Generators;
using Avalonia.Input;
using Avalonia.VisualTree;
using Avalonia.Xaml.Interactions.DragAndDrop;
@@ -2,7 +2,6 @@ using System;
using System.Reactive.Disposables;
using Artemis.UI.Shared;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using ReactiveUI;
@@ -9,15 +9,12 @@
x:Class="Artemis.UI.Screens.Sidebar.SidebarView"
x:DataType="sidebar:SidebarViewModel">
<UserControl.Styles>
<StyleInclude Source="avares://Avalonia.Xaml.Interactions/Draggable/Styles.axaml" />
<StyleInclude Source="avares://Avalonia.Xaml.Interactions.Draggable/Styles.axaml" />
</UserControl.Styles>
<Grid RowDefinitions="60,Auto,Auto,*,Auto,Auto">
<Grid Grid.Row="0" IsHitTestVisible="False" ColumnDefinitions="Auto,*">
<Image Grid.Column="0" Margin="12" Source="/Assets/Images/Logo/bow.png" RenderOptions.BitmapInterpolationMode="HighQuality" />
<TextBlock Grid.Column="1"
FontSize="24"
VerticalAlignment="Center"
Foreground="{DynamicResource MaterialDesignDarkForeground}">
<TextBlock Grid.Column="1" FontSize="24" VerticalAlignment="Center">
Artemis 2
</TextBlock>
</Grid>
@@ -3,9 +3,7 @@ using System.Reactive.Disposables;
using Artemis.UI.Screens.StartupWizard.Steps;
using Artemis.UI.Shared;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Navigation;
using ReactiveUI;
@@ -3,15 +3,12 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reflection;
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.Core.DeviceProviders;
using Artemis.Core.Services;
using Artemis.UI.DryIoc.Factories;
using Artemis.UI.Screens.Plugins;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Services.Updating;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Providers;
using Artemis.UI.Shared.Services;
@@ -30,7 +30,7 @@
<TextBlock Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top"
Foreground="{DynamicResource MaterialDesignBodyLight}"
Classes="subtitle"
Text="{Binding Version}" />
<controls:HyperlinkButton Grid.Row="1"
@@ -64,7 +64,7 @@
</UserControl.Resources>
<Grid Margin="0 0 15 15" ColumnDefinitions="*,400">
<Border Grid.Column="0" Classes="card-condensed">
<paz:ZoomBorder Name="ZoomBorder"
<paz:ZoomBorder Name="ContainerZoomBorder"
Stretch="None"
ClipToBounds="True"
Focusable="True"
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Events;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Generators;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
@@ -18,7 +16,7 @@ public partial class SurfaceEditorView : ReactiveUserControl<SurfaceEditorViewMo
public SurfaceEditorView()
{
InitializeComponent();
ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
ContainerZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
UpdateZoomBorderBackground();
}
@@ -36,7 +34,7 @@ public partial class SurfaceEditorView : ReactiveUserControl<SurfaceEditorViewMo
private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e)
{
UpdateZoomBorderBackground();
SurfaceBounds.BorderThickness = new Thickness(2 / ZoomBorder.ZoomX);
SurfaceBounds.BorderThickness = new Thickness(2 / ContainerZoomBorder.ZoomX);
}
private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e)
@@ -54,7 +52,7 @@ public partial class SurfaceEditorView : ReactiveUserControl<SurfaceEditorViewMo
private void UpdateZoomBorderBackground()
{
if (ZoomBorder.Background is VisualBrush visualBrush)
visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute);
if (ContainerZoomBorder.Background is VisualBrush visualBrush)
visualBrush.DestinationRect = new RelativeRect(ContainerZoomBorder.OffsetX * -1, ContainerZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute);
}
}
@@ -3,8 +3,6 @@ using System.Linq;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Mixins;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
@@ -2,9 +2,6 @@ using System;
using System.Linq;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Mixins;
using Avalonia.Controls.Shapes;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.ReactiveUI;
@@ -3,8 +3,6 @@ using System.Reactive.Disposables;
using System.Reactive.Linq;
using Artemis.Core;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Mixins;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Input;
using Avalonia.LogicalTree;
@@ -35,7 +35,7 @@
<KeyBinding Command="{CompiledBinding History.Undo}" Gesture="Ctrl+Z" />
<KeyBinding Command="{CompiledBinding History.Redo}" Gesture="Ctrl+Y" />
</UserControl.KeyBindings>
<paz:ZoomBorder Name="ZoomBorder"
<paz:ZoomBorder Name="NodeScriptZoomBorder"
Stretch="None"
Focusable="True"
VerticalAlignment="Stretch"
@@ -86,7 +86,7 @@
</ItemsControl>
<shared:SelectionRectangle Name="SelectionRectangle"
InputElement="{Binding #ZoomBorder}"
InputElement="{Binding #NodeScriptZoomBorder}"
SelectionUpdated="SelectionRectangle_OnSelectionUpdated"
SelectionFinished="SelectionRectangle_OnSelectionFinished"
BorderBrush="{DynamicResource SystemAccentColor}"
@@ -2,11 +2,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Events;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Generators;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Input;
using Avalonia.Interactivity;
@@ -25,26 +23,26 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
{
InitializeComponent();
ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
UpdateZoomBorderBackground();
ZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
ZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
ZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
this.WhenActivated(d =>
{
ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested;
ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d);
if (ViewModel.IsPreview)
{
BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d);
ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d);
}
Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle);
Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d);
});
// NodeScriptZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
// UpdateZoomBorderBackground();
//
// NodeScriptZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
// NodeScriptZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
// NodeScriptZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
//
// this.WhenActivated(d =>
// {
// ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested;
// ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d);
// if (ViewModel.IsPreview)
// {
// BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d);
// ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d);
// }
//
// Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle);
// Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d);
// });
}
protected override Size MeasureOverride(Size availableSize)
@@ -56,7 +54,7 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
private void ZoomOnPointerWheelChanged(object? sender, PointerWheelEventArgs e)
{
// If scroll events aren't handled here the ZoomBorder does some random panning when at the zoom limit
if (e.Delta.Y > 0 && ZoomBorder.ZoomX >= 1)
if (e.Delta.Y > 0 && NodeScriptZoomBorder.ZoomX >= 1)
e.Handled = true;
}
@@ -71,7 +69,7 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
if (ViewModel == null)
return;
ViewModel.NodePickerViewModel.Position = point;
ZoomBorder?.ContextFlyout?.ShowAt(ZoomBorder);
NodeScriptZoomBorder?.ContextFlyout?.ShowAt(NodeScriptZoomBorder);
}
private void AutoFitIfPreview()
@@ -111,8 +109,8 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
double scale = Math.Min(1, 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);
NodeScriptZoomBorder.Zoom(scale, 0, 0, skipTransitions);
NodeScriptZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions);
}
private void ViewModelOnAutoFitRequested(object? sender, EventArgs e)
@@ -122,14 +120,14 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property.Name == nameof(ZoomBorder.Background))
if (e.Property.Name == nameof(NodeScriptZoomBorder.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 (NodeScriptZoomBorder.Background is VisualBrush visualBrush)
visualBrush.DestinationRect = new RelativeRect(NodeScriptZoomBorder.OffsetX * -1, NodeScriptZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute);
}
private void InitializeComponent()
@@ -140,7 +138,7 @@ public partial class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e)
{
if (ViewModel != null)
ViewModel.PanMatrix = ZoomBorder.Matrix;
ViewModel.PanMatrix = NodeScriptZoomBorder.Matrix;
UpdateZoomBorderBackground();
}