mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
Ctrl+S 😔
This commit is contained in:
parent
e4dcc3044e
commit
1a3b33d154
@ -12,10 +12,7 @@ using Artemis.Core.Services.Interfaces;
|
|||||||
using Artemis.Core.Services.Storage;
|
using Artemis.Core.Services.Storage;
|
||||||
using Artemis.UI.ViewModels.Controls.SurfaceEditor;
|
using Artemis.UI.ViewModels.Controls.SurfaceEditor;
|
||||||
using Artemis.UI.ViewModels.Interfaces;
|
using Artemis.UI.ViewModels.Interfaces;
|
||||||
using MahApps.Metro.Controls;
|
|
||||||
using RGB.NET.Core;
|
|
||||||
using Stylet;
|
using Stylet;
|
||||||
using Point = System.Windows.Point;
|
|
||||||
|
|
||||||
namespace Artemis.UI.ViewModels.Screens
|
namespace Artemis.UI.ViewModels.Screens
|
||||||
{
|
{
|
||||||
@ -42,8 +39,6 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title => "Surface Editor";
|
|
||||||
|
|
||||||
public RectangleGeometry SelectionRectangle { get; set; }
|
public RectangleGeometry SelectionRectangle { get; set; }
|
||||||
public ObservableCollection<SurfaceDeviceViewModel> Devices { get; set; }
|
public ObservableCollection<SurfaceDeviceViewModel> Devices { get; set; }
|
||||||
|
|
||||||
@ -59,8 +54,10 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
set => Zoom = value / 100;
|
set => Zoom = value / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double PanX { get; set; } = 0;
|
public double PanX { get; set; }
|
||||||
public double PanY { get; set; } = 0;
|
public double PanY { get; set; }
|
||||||
|
|
||||||
|
public string Title => "Surface Editor";
|
||||||
|
|
||||||
private void RgbServiceOnDeviceLoaded(object sender, DeviceEventArgs e)
|
private void RgbServiceOnDeviceLoaded(object sender, DeviceEventArgs e)
|
||||||
{
|
{
|
||||||
@ -114,6 +111,16 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
NewConfigurationName = null;
|
NewConfigurationName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Overrides of Screen
|
||||||
|
|
||||||
|
protected override void OnActivate()
|
||||||
|
{
|
||||||
|
Task.Run(LoadSurfaceConfigurations);
|
||||||
|
base.OnActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Context menu actions
|
#region Context menu actions
|
||||||
|
|
||||||
public void BringToFront(SurfaceDeviceViewModel surfaceDeviceViewModel)
|
public void BringToFront(SurfaceDeviceViewModel surfaceDeviceViewModel)
|
||||||
@ -300,7 +307,7 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
public void EditorGridMouseWheel(object sender, MouseWheelEventArgs e)
|
public void EditorGridMouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
// Get the mouse position relative to the panned / zoomed grid, not very MVVM but I can't find a better way
|
// Get the mouse position relative to the panned / zoomed grid, not very MVVM but I can't find a better way
|
||||||
var relative = e.GetPosition(((Grid)sender).Children[0]);
|
var relative = e.GetPosition(((Grid) sender).Children[0]);
|
||||||
var absoluteX = relative.X * Zoom + PanX;
|
var absoluteX = relative.X * Zoom + PanX;
|
||||||
var absoluteY = relative.Y * Zoom + PanY;
|
var absoluteY = relative.Y * Zoom + PanY;
|
||||||
|
|
||||||
@ -316,21 +323,17 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
PanX = absoluteX - relative.X * Zoom;
|
PanX = absoluteX - relative.X * Zoom;
|
||||||
PanY = absoluteY - relative.Y * Zoom;
|
PanY = absoluteY - relative.Y * Zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditorGridKeyDown(object sender, KeyEventArgs e)
|
public void EditorGridKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
|
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
|
||||||
{
|
|
||||||
Mouse.OverrideCursor = Cursors.ScrollAll;
|
Mouse.OverrideCursor = Cursors.ScrollAll;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditorGridKeyUp(object sender, KeyEventArgs e)
|
public void EditorGridKeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
|
if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
|
||||||
{
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pan(object sender, MouseEventArgs e)
|
public void Pan(object sender, MouseEventArgs e)
|
||||||
@ -341,7 +344,7 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
_lastPanPosition = null;
|
_lastPanPosition = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_lastPanPosition == null)
|
if (_lastPanPosition == null)
|
||||||
_lastPanPosition = e.GetPosition((IInputElement) sender);
|
_lastPanPosition = e.GetPosition((IInputElement) sender);
|
||||||
|
|
||||||
@ -355,7 +358,7 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
|
|
||||||
_lastPanPosition = position;
|
_lastPanPosition = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetZoomAndPan()
|
public void ResetZoomAndPan()
|
||||||
{
|
{
|
||||||
Zoom = 1;
|
Zoom = 1;
|
||||||
@ -369,16 +372,6 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Overrides of Screen
|
|
||||||
|
|
||||||
protected override void OnActivate()
|
|
||||||
{
|
|
||||||
Task.Run(LoadSurfaceConfigurations);
|
|
||||||
base.OnActivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum MouseDragStatus
|
internal enum MouseDragStatus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user