mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Updated for RGB.NET's changes regarding rotation
This commit is contained in:
parent
97907c97eb
commit
086f2fc1f9
@ -157,7 +157,7 @@
|
||||
<Compile Include="Extensions\RgbRectangleExtensions.cs" />
|
||||
<Compile Include="Extensions\TypeExtensions.cs" />
|
||||
<Compile Include="Models\DataModelDescription.cs" />
|
||||
<Compile Include="Models\Surface\Led.cs" />
|
||||
<Compile Include="Models\Surface\DeviceLed.cs" />
|
||||
<Compile Include="Models\Surface\Surface.cs" />
|
||||
<Compile Include="Models\Surface\Device.cs" />
|
||||
<Compile Include="Ninject\LoggerProvider.cs" />
|
||||
|
||||
@ -7,10 +7,10 @@ namespace Artemis.Core.Extensions
|
||||
public static Rectangle ToDrawingRectangle(this global::RGB.NET.Core.Rectangle rectangle, double scale)
|
||||
{
|
||||
return new Rectangle(
|
||||
(int) (rectangle.X * scale),
|
||||
(int) (rectangle.Y * scale),
|
||||
(int) (rectangle.Width * scale),
|
||||
(int) (rectangle.Height * scale)
|
||||
(int) (rectangle.Location.X * scale),
|
||||
(int) (rectangle.Location.Y * scale),
|
||||
(int) (rectangle.Size.Width * scale),
|
||||
(int) (rectangle.Size.Height * scale)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Models.Profile.Abstract;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Device = Artemis.Core.Models.Surface.Device;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
@ -18,6 +24,7 @@ namespace Artemis.Core.Models.Profile
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
Name = name;
|
||||
Leds = new List<DeviceLed>();
|
||||
}
|
||||
|
||||
internal Layer(Profile profile, Folder folder, LayerEntity layerEntity, IPluginService pluginService)
|
||||
@ -28,6 +35,7 @@ namespace Artemis.Core.Models.Profile
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
LayerType = pluginService.GetLayerTypeByGuid(layerEntity.LayerTypeGuid);
|
||||
Leds = new List<DeviceLed>();
|
||||
}
|
||||
|
||||
internal LayerEntity LayerEntity { get; set; }
|
||||
@ -36,9 +44,13 @@ namespace Artemis.Core.Models.Profile
|
||||
public Profile Profile { get; }
|
||||
public Folder ParentFolder { get; }
|
||||
|
||||
public List<DeviceLed> Leds { get; private set; }
|
||||
public LayerType LayerType { get; private set; }
|
||||
public ILayerTypeConfiguration LayerTypeConfiguration { get; set; }
|
||||
|
||||
public Rectangle RenderRectangle { get; set; }
|
||||
public GraphicsPath RenderPath { get; set; }
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
if (LayerType == null)
|
||||
@ -71,10 +83,22 @@ namespace Artemis.Core.Models.Profile
|
||||
LayerEntity.Name = Name;
|
||||
|
||||
LayerEntity.ProfileId = Profile.EntityId;
|
||||
|
||||
// TODO: LEDs, conditions, elements
|
||||
}
|
||||
|
||||
public void ApplySurface(Surface.Surface surface)
|
||||
{
|
||||
var leds = new List<DeviceLed>();
|
||||
foreach (var surfaceDevice in surface.Devices)
|
||||
{
|
||||
var deviceHash = surfaceDevice.RgbDevice.GetDeviceHashCode();
|
||||
leds.AddRange(surfaceDevice.Leds.Where(dl => LayerEntity.Leds.Any(l => l.DeviceHash == deviceHash && l.LedName == dl.RgbLed.ToString())));
|
||||
}
|
||||
|
||||
Leds = leds;
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
public void UpdateLayerType(LayerType layerType)
|
||||
{
|
||||
if (LayerType != null)
|
||||
@ -88,6 +112,27 @@ namespace Artemis.Core.Models.Profile
|
||||
LayerType = layerType;
|
||||
}
|
||||
|
||||
internal void CalculateRenderProperties()
|
||||
{
|
||||
if (!Leds.Any())
|
||||
{
|
||||
// TODO: Create an empty rectangle and path
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine to top-left and bottom-right
|
||||
var minX = Leds.Min(l => l.AbsoluteRenderRectangle.X);
|
||||
var minY = Leds.Min(l => l.AbsoluteRenderRectangle.Y);
|
||||
var maxX = Leds.Max(l => l.AbsoluteRenderRectangle.X);
|
||||
var maxY = Leds.Max(l => l.AbsoluteRenderRectangle.Y);
|
||||
|
||||
RenderRectangle = new Rectangle(minX, minY, maxX - minX, maxY - minY);
|
||||
|
||||
var path = new GraphicsPath();
|
||||
path.AddRectangles(Leds.Select(l => l.AbsoluteRenderRectangle).ToArray());
|
||||
RenderPath = path;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(Profile)}: {Profile}, {nameof(Order)}: {Order}, {nameof(Name)}: {Name}";
|
||||
|
||||
@ -139,5 +139,11 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void ApplySurface(Surface.Surface surface)
|
||||
{
|
||||
foreach (var layer in GetAllLayers())
|
||||
layer.ApplySurface(surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ namespace Artemis.Core.Models.Surface
|
||||
ZIndex = 1;
|
||||
|
||||
ApplyToEntity();
|
||||
CalculateRenderRectangle();
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
internal Device(IRGBDevice rgbDevice, Plugin plugin, Surface surface, DeviceEntity deviceEntity)
|
||||
@ -78,10 +78,12 @@ namespace Artemis.Core.Models.Surface
|
||||
internal void ApplyToRgbDevice()
|
||||
{
|
||||
RgbDevice.Location = new Point(DeviceEntity.X, DeviceEntity.Y);
|
||||
CalculateRenderRectangle();
|
||||
RgbDevice.Rotation = DeviceEntity.Rotation;
|
||||
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
internal void CalculateRenderRectangle()
|
||||
internal void CalculateRenderProperties()
|
||||
{
|
||||
RenderRectangle = new Rectangle(
|
||||
(int) Math.Round(RgbDevice.Location.X * Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
@ -98,6 +100,7 @@ namespace Artemis.Core.Models.Surface
|
||||
|
||||
var path = new GraphicsPath();
|
||||
path.AddRectangles(Leds.Select(l => l.AbsoluteRenderRectangle).ToArray());
|
||||
path.FillMode = FillMode.Winding;
|
||||
RenderPath = path;
|
||||
}
|
||||
|
||||
|
||||
38
src/Artemis.Core/Models/Surface/DeviceLed.cs
Normal file
38
src/Artemis.Core/Models/Surface/DeviceLed.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using Rectangle = System.Drawing.Rectangle;
|
||||
|
||||
namespace Artemis.Core.Models.Surface
|
||||
{
|
||||
public class DeviceLed
|
||||
{
|
||||
public DeviceLed(Led led, Device device)
|
||||
{
|
||||
RgbLed = led;
|
||||
Device = device;
|
||||
CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
public Led RgbLed { get; }
|
||||
public Device Device { get; }
|
||||
|
||||
public Rectangle RenderRectangle { get; private set; }
|
||||
public Rectangle AbsoluteRenderRectangle { get; private set; }
|
||||
|
||||
public void CalculateRenderRectangle()
|
||||
{
|
||||
RenderRectangle = new Rectangle(
|
||||
(int) Math.Round(RgbLed.LedRectangle.Location.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Location.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Size.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Size.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
|
||||
);
|
||||
AbsoluteRenderRectangle = new Rectangle(
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Location.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Location.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Size.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Size.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using Rectangle = System.Drawing.Rectangle;
|
||||
|
||||
namespace Artemis.Core.Models.Surface
|
||||
{
|
||||
public class DeviceLed
|
||||
{
|
||||
public DeviceLed(Led led, Device device)
|
||||
{
|
||||
RgbLed = led;
|
||||
Device = device;
|
||||
CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
public Led RgbLed { get; }
|
||||
public Device Device { get; }
|
||||
|
||||
public Rectangle RenderRectangle { get; private set; }
|
||||
public Rectangle AbsoluteRenderRectangle { get; private set; }
|
||||
|
||||
public void CalculateRenderRectangle()
|
||||
{
|
||||
RenderRectangle = new Rectangle(
|
||||
(int) Math.Round(RgbLed.LedRectangle.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.LedRectangle.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
|
||||
);
|
||||
AbsoluteRenderRectangle = new Rectangle(
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
|
||||
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace Artemis.Core.Models.Surface
|
||||
{
|
||||
Scale = value;
|
||||
foreach (var device in Devices)
|
||||
device.CalculateRenderRectangle();
|
||||
device.CalculateRenderProperties();
|
||||
|
||||
OnScaleChanged();
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ namespace Artemis.Core.RGB.NET
|
||||
_bitmap = null;
|
||||
else
|
||||
{
|
||||
var width = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.X + l.AbsoluteLedRectangle.Width) * scale, 4096);
|
||||
var height = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height) * scale, 4096);
|
||||
var width = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.Location.X + l.AbsoluteLedRectangle.Size.Width) * scale, 4096);
|
||||
var height = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.Location.Y + l.AbsoluteLedRectangle.Size.Height) * scale, 4096);
|
||||
|
||||
_bitmap = new DirectBitmap((int) width, (int) height);
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Exceptions;
|
||||
@ -21,6 +22,7 @@ namespace Artemis.Core.Services
|
||||
private readonly IPluginService _pluginService;
|
||||
private readonly IRgbService _rgbService;
|
||||
private readonly ISurfaceService _surfaceService;
|
||||
private List<Module> _modules;
|
||||
|
||||
internal CoreService(ILogger logger, IPluginService pluginService, IRgbService rgbService, ISurfaceService surfaceService)
|
||||
{
|
||||
@ -31,6 +33,10 @@ namespace Artemis.Core.Services
|
||||
_rgbService.Surface.Updating += SurfaceOnUpdating;
|
||||
_rgbService.Surface.Updated += SurfaceOnUpdated;
|
||||
|
||||
_modules = _pluginService.GetPluginsOfType<Module>();
|
||||
_pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
|
||||
Task.Run(Initialize);
|
||||
}
|
||||
|
||||
@ -66,11 +72,12 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
var modules = _pluginService.GetPluginsOfType<Module>();
|
||||
|
||||
// Update all active modules
|
||||
foreach (var module in modules)
|
||||
module.Update(args.DeltaTime);
|
||||
lock (_modules)
|
||||
{
|
||||
// Update all active modules
|
||||
foreach (var module in _modules)
|
||||
module.Update(args.DeltaTime);
|
||||
}
|
||||
|
||||
// If there is no graphics decorator, skip the frame
|
||||
if (_rgbService.GraphicsDecorator == null)
|
||||
@ -84,11 +91,14 @@ namespace Artemis.Core.Services
|
||||
return;
|
||||
|
||||
g.Clear(Color.Black);
|
||||
foreach (var module in modules)
|
||||
module.Render(args.DeltaTime, _surfaceService.ActiveSurface, g);
|
||||
lock (_modules)
|
||||
{
|
||||
foreach (var module in _modules)
|
||||
module.Render(args.DeltaTime, _surfaceService.ActiveSurface, g);
|
||||
}
|
||||
}
|
||||
|
||||
OnFrameRendering(new FrameRenderingEventArgs(modules, _rgbService.GraphicsDecorator.GetBitmap(), args.DeltaTime, _rgbService.Surface));
|
||||
OnFrameRendering(new FrameRenderingEventArgs(_modules, _rgbService.GraphicsDecorator.GetBitmap(), args.DeltaTime, _rgbService.Surface));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@ -48,5 +48,10 @@ namespace Artemis.Core.Services.Storage.Interfaces
|
||||
/// Occurs when the active device entity has been changed
|
||||
/// </summary>
|
||||
event EventHandler<SurfaceConfigurationEventArgs> ActiveSurfaceConfigurationChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a surface configuration has been updated
|
||||
/// </summary>
|
||||
event EventHandler<SurfaceConfigurationEventArgs> SurfaceConfigurationUpdated;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
@ -14,12 +16,36 @@ namespace Artemis.Core.Services.Storage
|
||||
public class ProfileService : IProfileService
|
||||
{
|
||||
private readonly IPluginService _pluginService;
|
||||
private readonly ISurfaceService _surfaceService;
|
||||
private readonly IProfileRepository _profileRepository;
|
||||
|
||||
internal ProfileService(IPluginService pluginService, IProfileRepository profileRepository)
|
||||
internal ProfileService(IPluginService pluginService, ISurfaceService surfaceService, IProfileRepository profileRepository)
|
||||
{
|
||||
_pluginService = pluginService;
|
||||
_surfaceService = surfaceService;
|
||||
_profileRepository = profileRepository;
|
||||
|
||||
_surfaceService.ActiveSurfaceConfigurationChanged += SurfaceServiceOnActiveSurfaceConfigurationChanged;
|
||||
_surfaceService.SurfaceConfigurationUpdated += SurfaceServiceOnSurfaceConfigurationUpdated;
|
||||
}
|
||||
|
||||
private void SurfaceServiceOnActiveSurfaceConfigurationChanged(object sender, SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
ApplySurfaceToProfiles(e.Surface);
|
||||
}
|
||||
|
||||
private void SurfaceServiceOnSurfaceConfigurationUpdated(object sender, SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
if (!e.Surface.IsActive)
|
||||
return;
|
||||
ApplySurfaceToProfiles(e.Surface);
|
||||
}
|
||||
|
||||
private void ApplySurfaceToProfiles(Surface surface)
|
||||
{
|
||||
var profileModules = _pluginService.GetPluginsOfType<ProfileModule>();
|
||||
foreach (var profileModule in profileModules.Where(p => p.ActiveProfile != null).ToList())
|
||||
profileModule.ActiveProfile.ApplySurface(surface);
|
||||
}
|
||||
|
||||
public List<Profile> GetProfiles(ProfileModule module)
|
||||
@ -55,6 +81,8 @@ namespace Artemis.Core.Services.Storage
|
||||
var profile = new Profile(module.PluginInfo, name);
|
||||
_profileRepository.Add(profile.ProfileEntity);
|
||||
|
||||
if (_surfaceService.ActiveSurface != null)
|
||||
profile.ApplySurface(_surfaceService.ActiveSurface);
|
||||
return profile;
|
||||
}
|
||||
|
||||
@ -70,6 +98,9 @@ namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
foreach (var profileElement in profile.Children)
|
||||
profileElement.ApplyToEntity();
|
||||
|
||||
if (_surfaceService.ActiveSurface != null)
|
||||
profile.ApplySurface(_surfaceService.ActiveSurface);
|
||||
}
|
||||
|
||||
_profileRepository.Save(profile.ProfileEntity);
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Artemis.Plugins.Modules.General
|
||||
_settings = settings;
|
||||
DisplayName = "General";
|
||||
ExpandsMainDataModel = true;
|
||||
DeviceBrushes= new Dictionary<Device, TextureBrush>();
|
||||
DeviceBrushes = new Dictionary<Device, TextureBrush>();
|
||||
|
||||
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Artemis.Plugins.Modules.General
|
||||
var brush = DeviceBrushes[device];
|
||||
brush.TranslateTransform((int) Math.Round(device.RenderRectangle.Width / 100.0 * MovePercentage), 0);
|
||||
graphics.FillPath(brush, device.RenderPath);
|
||||
brush.TranslateTransform((int)Math.Round(device.RenderRectangle.Width / 100.0 * MovePercentage) * -1, 0);
|
||||
brush.TranslateTransform((int) Math.Round(device.RenderRectangle.Width / 100.0 * MovePercentage) * -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Artemis.Storage.Entities.Profile
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public List<LedEntity> Leds { get; set; }
|
||||
public List<ProfileConditionEntity> Condition { get; set; }
|
||||
public List<LayerElementEntity> Elements { get; set; }
|
||||
|
||||
@ -7,6 +7,6 @@ namespace Artemis.Storage.Entities.Profile
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string LedName { get; set; }
|
||||
public string LimitedToDevice { get; set; }
|
||||
public int DeviceHash { get; set; }
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,6 @@
|
||||
<Compile Include="Converters\NullToImageConverter.cs" />
|
||||
<Compile Include="Converters\NullToVisibilityConverter.cs" />
|
||||
<Compile Include="Extensions\RgbColorExtensions.cs" />
|
||||
<Compile Include="Extensions\RgbRectangleExtensions.cs" />
|
||||
<Compile Include="Ninject\Factories\IModuleViewModelFactory.cs" />
|
||||
<Compile Include="Ninject\Factories\IProfileEditorViewModelFactory.cs" />
|
||||
<Compile Include="Ninject\UIModule.cs" />
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace Artemis.UI.Extensions
|
||||
{
|
||||
public static class RgbRectangleExtensions
|
||||
{
|
||||
public static Rectangle ToDrawingRectangle(this RGB.NET.Core.Rectangle rectangle)
|
||||
{
|
||||
return new Rectangle((int) rectangle.X, (int) rectangle.Y, (int) rectangle.Width, (int) rectangle.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,10 +13,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
public ProfileLedViewModel(Led led)
|
||||
{
|
||||
Led = led;
|
||||
X = Led.LedRectangle.X;
|
||||
Y = Led.LedRectangle.Y;
|
||||
Width = Led.LedRectangle.Width;
|
||||
Height = Led.LedRectangle.Height;
|
||||
X = Led.Location.X;
|
||||
Y = Led.Location.Y;
|
||||
Width = Led.Size.Width;
|
||||
Height = Led.Size.Height;
|
||||
|
||||
Execute.OnUIThread(CreateLedGeometry);
|
||||
}
|
||||
@ -63,17 +63,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
|
||||
private void CreateRectangleGeometry()
|
||||
{
|
||||
DisplayGeometry = new RectangleGeometry(new Rect(0.5, 0.5, Led.LedRectangle.Width - 1, Led.LedRectangle.Height - 1));
|
||||
DisplayGeometry = new RectangleGeometry(new Rect(0.5, 0.5, Led.Size.Width - 1, Led.Size.Height - 1));
|
||||
}
|
||||
|
||||
private void CreateCircleGeometry()
|
||||
{
|
||||
DisplayGeometry = new EllipseGeometry(new Rect(0.5, 0.5, Led.LedRectangle.Width - 1, Led.LedRectangle.Height - 1));
|
||||
DisplayGeometry = new EllipseGeometry(new Rect(0.5, 0.5, Led.Size.Width - 1, Led.Size.Height - 1));
|
||||
}
|
||||
|
||||
private void CreateKeyCapGeometry()
|
||||
{
|
||||
DisplayGeometry = new RectangleGeometry(new Rect(1, 1, Led.LedRectangle.Width - 2, Led.LedRectangle.Height - 2), 1.6, 1.6);
|
||||
DisplayGeometry = new RectangleGeometry(new Rect(1, 1, Led.Size.Width - 2, Led.Size.Height - 2), 1.6, 1.6);
|
||||
}
|
||||
|
||||
private void CreateCustomGeometry(double deflateAmount)
|
||||
@ -88,7 +88,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
{
|
||||
Children = new TransformCollection
|
||||
{
|
||||
new ScaleTransform(Led.LedRectangle.Width - deflateAmount, Led.LedRectangle.Height - deflateAmount),
|
||||
new ScaleTransform(Led.Size.Width - deflateAmount, Led.Size.Height - deflateAmount),
|
||||
new TranslateTransform(deflateAmount / 2, deflateAmount / 2)
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,10 +20,10 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
||||
|
||||
public void ApplyLedToViewModel()
|
||||
{
|
||||
X = Led.LedRectangle.X;
|
||||
Y = Led.LedRectangle.Y;
|
||||
Width = Led.LedRectangle.Width;
|
||||
Height = Led.LedRectangle.Height;
|
||||
X = Led.Location.X;
|
||||
Y = Led.Location.Y;
|
||||
Width = Led.Size.Width;
|
||||
Height = Led.Size.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user