mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added layer shapes, editor is still WIP
This commit is contained in:
1 parent
70bf0e1c43
commit
ddce69e8f0
115 files changed
+1949
-1189
No files matched your search
@@ -0,0 +1,39 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core.Models.Profile.LayerShapes;
|
||||
using Artemis.UI.Properties;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
public class FillToolViewModel : VisualizationToolViewModel
|
||||
{
|
||||
public FillToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
||||
{
|
||||
using (var stream = new MemoryStream(Resources.aero_fill))
|
||||
{
|
||||
Cursor = new Cursor(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public override void MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
base.MouseUp(sender, e);
|
||||
|
||||
// Find out if the click is inside a layer and if so, fill it
|
||||
var position = e.GetPosition((IInputElement) sender);
|
||||
var panZoomVm = ProfileViewModel.PanZoomViewModel;
|
||||
|
||||
var layer = ProfileEditorService.SelectedProfile
|
||||
.GetAllLayers()
|
||||
.FirstOrDefault(l => l.Leds.Any(
|
||||
led => panZoomVm.TransformContainingRect(led.RgbLed.AbsoluteLedRectangle).Contains(position))
|
||||
);
|
||||
|
||||
if (layer != null)
|
||||
layer.LayerShape = new Fill(layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user