mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added undo/redo to profile editor
Added shape anchor point display and movement
This commit is contained in:
1 parent
e9677f2070
commit
c97b479779
25 files changed
+386
-68
No files matched your search
+1
-1
@@ -51,7 +51,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
{
|
||||
// Either create a new first keyframe or clear all the keyframes
|
||||
if (_keyframesEnabled)
|
||||
LayerProperty.CreateNewKeyframe(_profileEditorService.CurrentTime);
|
||||
LayerProperty.CreateNewKeyframe(_profileEditorService.CurrentTime, LayerProperty.GetCurrentValue());
|
||||
else
|
||||
LayerProperty.ClearKeyframes();
|
||||
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@
|
||||
Padding="0 -1"
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding FloatInputValue}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" />
|
||||
Text="{Binding FloatInputValue}" />
|
||||
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
+1
-2
@@ -15,8 +15,7 @@
|
||||
Padding="0 -1"
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding IntInputValue}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" />
|
||||
Text="{Binding IntInputValue}"/>
|
||||
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
|
||||
protected object InputValue
|
||||
{
|
||||
get => LayerPropertyViewModel.LayerProperty.KeyframeEngine.GetCurrentValue();
|
||||
get => LayerPropertyViewModel.LayerProperty.GetCurrentValue();
|
||||
set => UpdateInputValue(value);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -16,8 +16,7 @@
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="X-coordinate (horizontal)"
|
||||
Text="{Binding X}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" KeyboardNavigation.IsTabStop="True" TabIndex="1" />
|
||||
Text="{Binding X}" />
|
||||
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
||||
<TextBox Width="60"
|
||||
Margin="0 2"
|
||||
@@ -25,8 +24,7 @@
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="Y-coordinate (vertical)"
|
||||
Text="{Binding Y}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" KeyboardNavigation.IsTabStop="True" TabIndex="2" />
|
||||
Text="{Binding Y}" />
|
||||
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
+2
-4
@@ -16,8 +16,7 @@
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="Height"
|
||||
Text="{Binding Height}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" />
|
||||
Text="{Binding Height}"/>
|
||||
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
||||
<TextBox Width="60"
|
||||
Margin="0 2"
|
||||
@@ -25,8 +24,7 @@
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="Width"
|
||||
Text="{Binding Width}"
|
||||
Cursor="/Resources/aero_drag_ew.cur" />
|
||||
Text="{Binding Width}" />
|
||||
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
+24
-3
@@ -14,15 +14,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private int _pixelsPerSecond;
|
||||
|
||||
public PropertyTrackKeyframeViewModel(BaseKeyframe keyframe, IProfileEditorService profileEditorService)
|
||||
public PropertyTrackKeyframeViewModel(PropertyTrackViewModel propertyTrackViewModel, BaseKeyframe keyframe, IProfileEditorService profileEditorService)
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
|
||||
PropertyTrackViewModel = propertyTrackViewModel;
|
||||
Keyframe = keyframe;
|
||||
EasingViewModels = new BindableCollection<PropertyTrackEasingViewModel>();
|
||||
CreateEasingViewModels();
|
||||
}
|
||||
|
||||
public bool IsSelected { get; set; }
|
||||
public PropertyTrackViewModel PropertyTrackViewModel { get; }
|
||||
public BaseKeyframe Keyframe { get; }
|
||||
public BindableCollection<PropertyTrackEasingViewModel> EasingViewModels { get; set; }
|
||||
public double X { get; set; }
|
||||
@@ -49,6 +52,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
public void KeyframeMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
((IInputElement) sender).ReleaseMouseCapture();
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
public void KeyframeMouseMove(object sender, MouseEventArgs e)
|
||||
@@ -72,7 +76,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
Keyframe.Position = newTime;
|
||||
|
||||
Update(_pixelsPerSecond);
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
_profileEditorService.UpdateProfilePreview();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,12 +89,29 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
Keyframe.Position = newTime;
|
||||
|
||||
Update(_pixelsPerSecond);
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
_profileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Context menu actions
|
||||
|
||||
public void Copy()
|
||||
{
|
||||
var keyframe = PropertyTrackViewModel.LayerPropertyViewModel.LayerProperty.CreateNewKeyframe(Keyframe.Position, Keyframe.BaseValue);
|
||||
keyframe.EasingFunction = Keyframe.EasingFunction;
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
PropertyTrackViewModel.LayerPropertyViewModel.LayerProperty.RemoveKeyframe(Keyframe);
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Easing
|
||||
|
||||
private void CreateEasingViewModels()
|
||||
|
||||
+11
-1
@@ -39,7 +39,17 @@
|
||||
MouseMove="{s:Action KeyframeMouseMove}">
|
||||
<Ellipse.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Copy" />
|
||||
<MenuItem Header="Copy" Command="{s:Action Copy}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="ContentCopy" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Delete" Command="{s:Action Delete}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="Delete" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="Easing" ItemsSource="{Binding EasingViewModels}">
|
||||
<MenuItem.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
{
|
||||
if (KeyframeViewModels.Any(k => k.Keyframe == keyframe))
|
||||
continue;
|
||||
KeyframeViewModels.Add(_propertyTrackKeyframeViewModelFactory.Create(keyframe));
|
||||
KeyframeViewModels.Add(_propertyTrackKeyframeViewModelFactory.Create(this, keyframe));
|
||||
}
|
||||
|
||||
UpdateKeyframes(PropertyTimelineViewModel.LayerPropertiesViewModel.PixelsPerSecond);
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.InputBindings>
|
||||
<KeyBinding Command="{s:Action Undo}" Modifiers="Control" Key="Z"></KeyBinding>
|
||||
<KeyBinding Command="{s:Action Redo}" Modifiers="Control" Key="Y"></KeyBinding>
|
||||
</UserControl.InputBindings>
|
||||
|
||||
<Grid Margin="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<!-- Left side -->
|
||||
|
||||
@@ -125,6 +125,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
_profileService.DeleteProfile(profile);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_profileEditorService.UndoUpdateProfile(Module);
|
||||
}
|
||||
|
||||
public void Redo()
|
||||
{
|
||||
_profileEditorService.RedoUpdateProfile(Module);
|
||||
}
|
||||
|
||||
private void ModuleOnActiveProfileChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedProfile == Module.ActiveProfile)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<!-- The part of the layer's shape that is inside the layer -->
|
||||
<Path Data="{Binding ShapeGeometry, Mode=OneWay}">
|
||||
<Path.Fill>
|
||||
<SolidColorBrush Color="{StaticResource Accent700}" Opacity="0.25" />
|
||||
<SolidColorBrush Color="{StaticResource Accent700}" Opacity="0.15" />
|
||||
</Path.Fill>
|
||||
<Path.Stroke>
|
||||
<SolidColorBrush Color="{StaticResource Accent700}" />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools.EditToolView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance {x:Type local:EditToolViewModel}}">
|
||||
<Canvas UseLayoutRounding="False">
|
||||
@@ -22,7 +22,13 @@
|
||||
Cursor="Hand"
|
||||
MouseDown="{s:Action ShapeEditMouseDown}"
|
||||
MouseUp="{s:Action ShapeEditMouseUp}"
|
||||
MouseMove="{s:Action Move}"/>
|
||||
MouseMove="{s:Action Move}" />
|
||||
|
||||
<!-- Anchor point -->
|
||||
<Ellipse MouseDown="{s:Action ShapeEditMouseDown}"
|
||||
MouseUp="{s:Action ShapeEditMouseUp}"
|
||||
MouseMove="{s:Action AnchorMove}"
|
||||
Width="6" Height="6" Fill="{DynamicResource SecondaryAccentBrush}" Canvas.Left="{Binding AnchorSkPoint.X}" Canvas.Top="{Binding AnchorSkPoint.Y}" Margin="-3,-3,0,0" Cursor="SizeAll" />
|
||||
|
||||
<!-- Top left display -->
|
||||
<Rectangle Width="4" Height="4" Canvas.Left="{Binding ShapeSkRect.Left}" Canvas.Top="{Binding ShapeSkRect.Top}" Fill="{DynamicResource SecondaryAccentBrush}" Margin="-2,-2,0,0" />
|
||||
@@ -112,4 +118,4 @@
|
||||
MouseMove="{s:Action CenterLeftResize}"
|
||||
Width="10" Height="10" Canvas.Left="{Binding ShapeSkRect.Left}" Canvas.Top="{Binding ShapeSkRect.MidY}" Fill="Transparent" Margin="-5,-5,0,0" Cursor="SizeWE" />
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
+120
-7
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.WPF;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
@@ -13,6 +15,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
private bool _isDragging;
|
||||
private double _dragOffsetY;
|
||||
private double _dragOffsetX;
|
||||
private Point _dragStart;
|
||||
private bool _draggingHorizontally;
|
||||
private bool _draggingVertically;
|
||||
|
||||
public EditToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
||||
{
|
||||
@@ -24,16 +29,21 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
profileEditorService.ProfilePreviewUpdated += (sender, args) => Update();
|
||||
}
|
||||
|
||||
public SKRect ShapeSkRect { get; set; }
|
||||
public SKPoint AnchorSkPoint { get; set; }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (ProfileEditorService.SelectedProfileElement is Layer layer)
|
||||
{
|
||||
ShapeSkRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
if (layer.LayerShape != null)
|
||||
{
|
||||
ShapeSkRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
AnchorSkPoint = layer.LayerShape.GetUnscaledAnchor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SKRect ShapeSkRect { get; set; }
|
||||
|
||||
public void ShapeEditMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (_isDragging)
|
||||
@@ -46,9 +56,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
_dragOffsetX = skRect.Left - dragStartPosition.X;
|
||||
_dragOffsetY = skRect.Top - dragStartPosition.Y;
|
||||
_dragStart = dragStartPosition;
|
||||
}
|
||||
|
||||
_isDragging = true;
|
||||
_draggingHorizontally = false;
|
||||
_draggingVertically = false;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
@@ -58,9 +72,22 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
|
||||
_isDragging = false;
|
||||
_draggingHorizontally = false;
|
||||
_draggingVertically = false;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
public void AnchorMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
return;
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
layer.LayerShape.SetFromUnscaledAnchor(new SKPoint((float) position.X, (float) position.Y), ProfileEditorService.CurrentTime);
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void Move(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
@@ -68,10 +95,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
layer.LayerShape.SetFromUnscaledRectangle(
|
||||
SKRect.Create((float) (position.X + _dragOffsetX), (float) (position.Y + _dragOffsetY), skRect.Width, skRect.Height),
|
||||
ProfileEditorService.CurrentTime
|
||||
);
|
||||
var x = (float) (position.X + _dragOffsetX);
|
||||
var y = (float) (position.Y + _dragOffsetY);
|
||||
|
||||
if (!Keyboard.IsKeyDown(Key.LeftShift) && !Keyboard.IsKeyDown(Key.RightShift))
|
||||
layer.LayerShape.SetFromUnscaledRectangle(SKRect.Create(x, y, skRect.Width, skRect.Height), ProfileEditorService.CurrentTime);
|
||||
else
|
||||
{
|
||||
if (_draggingVertically)
|
||||
layer.LayerShape.SetFromUnscaledRectangle(SKRect.Create(skRect.Left, y, skRect.Width, skRect.Height), ProfileEditorService.CurrentTime);
|
||||
else if (_draggingHorizontally)
|
||||
layer.LayerShape.SetFromUnscaledRectangle(SKRect.Create(x, skRect.Top, skRect.Width, skRect.Height), ProfileEditorService.CurrentTime);
|
||||
else
|
||||
{
|
||||
_draggingHorizontally = Math.Abs(position.X - _dragStart.X) > Math.Abs(position.Y - _dragStart.Y);
|
||||
_draggingVertically = Math.Abs(position.X - _dragStart.X) < Math.Abs(position.Y - _dragStart.Y);
|
||||
}
|
||||
}
|
||||
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
@@ -81,6 +122,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
public void TopLeftResize(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
return;
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
|
||||
{
|
||||
// Take the greatest difference
|
||||
// Base the smallest difference on the greatest difference, maintaining aspect ratio
|
||||
}
|
||||
else
|
||||
{
|
||||
skRect.Top = (float) Math.Min(position.Y, skRect.Bottom);
|
||||
skRect.Left = (float) Math.Min(position.X, skRect.Bottom);
|
||||
}
|
||||
|
||||
layer.LayerShape.SetFromUnscaledRectangle(skRect, ProfileEditorService.CurrentTime);
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void TopCenterResize(object sender, MouseEventArgs e)
|
||||
@@ -102,6 +161,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
public void TopRightResize(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
return;
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
|
||||
{
|
||||
// Take the greatest difference
|
||||
// Base the smallest difference on the greatest difference, maintaining aspect ratio
|
||||
}
|
||||
else
|
||||
{
|
||||
skRect.Top = (float) Math.Min(position.Y, skRect.Bottom);
|
||||
skRect.Right = (float) Math.Max(position.X, skRect.Left);
|
||||
}
|
||||
|
||||
layer.LayerShape.SetFromUnscaledRectangle(skRect, ProfileEditorService.CurrentTime);
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void CenterRightResize(object sender, MouseEventArgs e)
|
||||
@@ -129,6 +206,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
public void BottomRightResize(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
return;
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
|
||||
{
|
||||
// Take the greatest difference
|
||||
// Base the smallest difference on the greatest difference, maintaining aspect ratio
|
||||
}
|
||||
else
|
||||
{
|
||||
skRect.Bottom = (float) Math.Max(position.Y, skRect.Top);
|
||||
skRect.Right = (float) Math.Max(position.X, skRect.Left);
|
||||
}
|
||||
|
||||
layer.LayerShape.SetFromUnscaledRectangle(skRect, ProfileEditorService.CurrentTime);
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void BottomCenterResize(object sender, MouseEventArgs e)
|
||||
@@ -150,6 +245,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
public void BottomLeftResize(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isDragging || !(ProfileEditorService.SelectedProfileElement is Layer layer))
|
||||
return;
|
||||
|
||||
var position = GetRelativePosition(sender, e);
|
||||
var skRect = layer.LayerShape.GetUnscaledRectangle();
|
||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
|
||||
{
|
||||
// Take the greatest difference
|
||||
// Base the smallest difference on the greatest difference, maintaining aspect ratio
|
||||
}
|
||||
else
|
||||
{
|
||||
skRect.Bottom = (float) Math.Max(position.Y, skRect.Top);
|
||||
skRect.Left = (float) Math.Min(position.X, skRect.Right);
|
||||
}
|
||||
|
||||
layer.LayerShape.SetFromUnscaledRectangle(skRect, ProfileEditorService.CurrentTime);
|
||||
ProfileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void CenterLeftResize(object sender, MouseEventArgs e)
|
||||
|
||||
Reference in new issue
Block a user