mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Integrated visual scripting
This commit is contained in:
1 parent
372991a69b
commit
66ea718316
96 files changed
+2413
-238
No files matched your search
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Reactive.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Controls.PanAndZoom;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
@@ -16,7 +17,7 @@ public class NodePickerView : ReactiveUserControl<NodePickerViewModel>
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
ViewModel?.WhenAnyValue(vm => vm.IsVisible).Where(visible => !visible).Subscribe(_ => this.FindLogicalAncestorOfType<Grid>()?.ContextFlyout?.Hide()).DisposeWith(d);
|
||||
ViewModel?.WhenAnyValue(vm => vm.IsVisible).Where(visible => visible == false).Subscribe(_ => this.FindLogicalAncestorOfType<ZoomBorder>()?.ContextFlyout?.Hide()).DisposeWith(d);
|
||||
this.Get<TextBox>("SearchBox").SelectAll();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
MaxZoomY="1"
|
||||
EnableConstrains="True"
|
||||
PointerReleased="ZoomBorder_OnPointerReleased">
|
||||
<Grid Name="ContainerGrid" Background="Transparent" ClipToBounds="False">
|
||||
<Grid.ContextFlyout>
|
||||
<Flyout FlyoutPresenterClasses="node-picker-flyout">
|
||||
<ContentControl Content="{CompiledBinding NodePickerViewModel}" />
|
||||
</Flyout>
|
||||
</Grid.ContextFlyout>
|
||||
<paz:ZoomBorder.ContextFlyout>
|
||||
<Flyout FlyoutPresenterClasses="node-picker-flyout">
|
||||
<ContentControl Content="{CompiledBinding NodePickerViewModel}" />
|
||||
</Flyout>
|
||||
</paz:ZoomBorder.ContextFlyout>
|
||||
<Grid Name="ContainerGrid" Background="Transparent" ClipToBounds="False" Focusable="True">
|
||||
<Grid.Transitions>
|
||||
<Transitions>
|
||||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" />
|
||||
|
||||
@@ -25,10 +25,10 @@ namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
|
||||
{
|
||||
private readonly Grid _grid;
|
||||
private readonly ItemsControl _nodesContainer;
|
||||
private readonly SelectionRectangle _selectionRectangle;
|
||||
private readonly ZoomBorder _zoomBorder;
|
||||
private readonly Grid _grid;
|
||||
|
||||
public NodeScriptView()
|
||||
{
|
||||
@@ -41,8 +41,8 @@ public class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
|
||||
_zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged;
|
||||
UpdateZoomBorderBackground();
|
||||
|
||||
_grid.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
|
||||
_zoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
_zoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
ViewModel!.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d);
|
||||
@@ -56,6 +56,13 @@ public 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)
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
AutoFitIfPreview();
|
||||
@@ -67,7 +74,7 @@ public class NodeScriptView : ReactiveUserControl<NodeScriptViewModel>
|
||||
if (ViewModel == null)
|
||||
return;
|
||||
ViewModel.NodePickerViewModel.Position = point;
|
||||
_grid?.ContextFlyout?.ShowAt(_grid, true);
|
||||
_zoomBorder?.ContextFlyout?.ShowAt(_zoomBorder, true);
|
||||
}
|
||||
|
||||
private void AutoFitIfPreview()
|
||||
|
||||
Reference in new issue
Block a user