Added rotating rotation cursors (think about that one for a sec!)

This commit is contained in:
Robert committed 2020-01-28 19:51:43 +01:00
1 parent c3a11386b4
commit 19bbef4cad
10 files changed
+168 -5

No files matched your search

@@ -19,28 +19,28 @@
Canvas.Left="{Binding TopLeft.X}"
Canvas.Top="{Binding TopLeft.Y}"
Fill="Transparent"
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" />
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="{Binding TopLeftRotateCursor}" />
<Ellipse Width="{Binding RotateSize}"
Height="{Binding RotateSize}"
Margin="{Binding RotateOffset}"
Canvas.Left="{Binding TopRight.X}"
Canvas.Top="{Binding TopRight.Y}"
Fill="Transparent"
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" />
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="{Binding TopRightRotateCursor}" />
<Ellipse Width="{Binding RotateSize}"
Height="{Binding RotateSize}"
Margin="{Binding RotateOffset}"
Canvas.Left="{Binding BottomRight.X}"
Canvas.Top="{Binding BottomRight.Y}"
Fill="Transparent"
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" />
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="{Binding BottomRightRotateCursor}" />
<Ellipse Width="{Binding RotateSize}"
Height="{Binding RotateSize}"
Margin="{Binding RotateOffset}"
Canvas.Left="{Binding BottomLeft.X}"
Canvas.Top="{Binding BottomLeft.Y}"
Fill="Transparent"
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" />
MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="{Binding BottomLeftRotateCursor}" />
<!-- The part of the layer's shape that is inside the layer -->
<Path Data="{Binding ShapeGeometry, Mode=OneWay}"
Fill="Transparent"
@@ -4,8 +4,10 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Artemis.Core.Models.Profile;
using Artemis.UI.Properties;
using Artemis.UI.Services;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Utilities;
using SkiaSharp;
using SkiaSharp.Views.WPF;
using Stylet;
@@ -60,6 +62,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
public SKPoint BottomCenter { get; set; }
public SKPoint LeftCenter { get; set; }
public Cursor TopLeftRotateCursor { get; set; }
public Cursor TopRightRotateCursor { get; set; }
public Cursor BottomRightRotateCursor { get; set; }
public Cursor BottomLeftRotateCursor { get; set; }
private void Update()
{
if (!(ProfileEditorService.SelectedProfileElement is Layer layer))
@@ -80,6 +87,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
BottomCenter = new SKPoint((BottomLeft.X + BottomRight.X) / 2, (BottomLeft.Y + BottomRight.Y) / 2);
LeftCenter = new SKPoint((TopLeft.X + BottomLeft.X) / 2, (TopLeft.Y + BottomLeft.Y) / 2);
TopLeftRotateCursor = CursorUtilities.GetRotatedCursor(Resources.aero_rotate_tl_ico, layer.RotationProperty.CurrentValue);
TopRightRotateCursor = CursorUtilities.GetRotatedCursor(Resources.aero_rotate_tr_ico, layer.RotationProperty.CurrentValue);
BottomRightRotateCursor = CursorUtilities.GetRotatedCursor(Resources.aero_rotate_br_ico, layer.RotationProperty.CurrentValue);
BottomLeftRotateCursor = CursorUtilities.GetRotatedCursor(Resources.aero_rotate_bl_ico, layer.RotationProperty.CurrentValue);
Execute.PostToUIThread(() =>
{
var shapeGeometry = new RectangleGeometry(_layerEditorService.GetShapeRenderRect(layer.LayerShape))
@@ -92,7 +104,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
ShapeTransformCollection.Freeze();
});
}
private void UpdateControls()
{
ControlSize = Math.Max(10 / ProfileViewModel.PanZoomViewModel.Zoom, 4);