mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge branch 'development'
This commit is contained in:
commit
cb616da756
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.LayerEffects;
|
||||
|
||||
@ -107,6 +107,11 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public ProfileConfigurationHotkey? DisableHotkey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ID of the profile of this profile configuration
|
||||
/// </summary>
|
||||
public Guid ProfileId => Entity.ProfileId;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile of this profile configuration
|
||||
/// </summary>
|
||||
|
||||
@ -8,8 +8,8 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public class ArtemisLed : CorePropertyChanged
|
||||
{
|
||||
private SKRectI _absoluteRectangle;
|
||||
private SKRectI _rectangle;
|
||||
private SKRect _absoluteRectangle;
|
||||
private SKRect _rectangle;
|
||||
|
||||
internal ArtemisLed(Led led, ArtemisDevice device)
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Gets the rectangle covering the LED positioned relative to the<see cref="Device" />
|
||||
/// </summary>
|
||||
public SKRectI Rectangle
|
||||
public SKRect Rectangle
|
||||
{
|
||||
get => _rectangle;
|
||||
private set => SetAndNotify(ref _rectangle, value);
|
||||
@ -40,7 +40,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Gets the rectangle covering the LED
|
||||
/// </summary>
|
||||
public SKRectI AbsoluteRectangle
|
||||
public SKRect AbsoluteRectangle
|
||||
{
|
||||
get => _absoluteRectangle;
|
||||
private set => SetAndNotify(ref _absoluteRectangle, value);
|
||||
@ -59,8 +59,8 @@ namespace Artemis.Core
|
||||
|
||||
internal void CalculateRectangles()
|
||||
{
|
||||
Rectangle = RgbLed.Boundary.ToSKRectI();
|
||||
AbsoluteRectangle = RgbLed.AbsoluteBoundary.ToSKRectI();
|
||||
Rectangle = RgbLed.Boundary.ToSKRect();
|
||||
AbsoluteRectangle = RgbLed.AbsoluteBoundary.ToSKRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,8 +87,8 @@ namespace Artemis.Core
|
||||
|
||||
if (led != null)
|
||||
{
|
||||
led.Location = new Point(MathF.Round(layoutLed.X), MathF.Round(layoutLed.Y));
|
||||
led.Size = new Size(MathF.Round(layoutLed.Width), MathF.Round(layoutLed.Height));
|
||||
led.Location = new Point(layoutLed.X, layoutLed.Y);
|
||||
led.Size = new Size(layoutLed.Width, layoutLed.Height);
|
||||
led.Shape = layoutLed.Shape;
|
||||
led.ShapeData = layoutLed.ShapeData;
|
||||
led.LayoutMetadata = layoutLed.CustomData;
|
||||
|
||||
@ -157,7 +157,7 @@ namespace Artemis.UI.Shared
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
if (disposing)
|
||||
_timer.Dispose();
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ namespace Artemis.UI.Shared
|
||||
double y = position.Y / RenderSize.Height;
|
||||
|
||||
Point scaledPosition = new(x * Device.Rectangle.Width, y * Device.Rectangle.Height);
|
||||
DeviceVisualizerLed? deviceVisualizerLed = _deviceVisualizerLeds.FirstOrDefault(l => l.DisplayGeometry != null && l.LedRect.Contains(scaledPosition));
|
||||
DeviceVisualizerLed? deviceVisualizerLed = _deviceVisualizerLeds.FirstOrDefault(l => l.HitTest(scaledPosition));
|
||||
if (deviceVisualizerLed != null)
|
||||
OnLedClicked(new LedClickedEventArgs(deviceVisualizerLed.Led.Device, deviceVisualizerLed.Led));
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ using System.Windows.Media.Imaging;
|
||||
using Artemis.Core;
|
||||
using RGB.NET.Core;
|
||||
using Color = System.Windows.Media.Color;
|
||||
using Point = System.Windows.Point;
|
||||
using SolidColorBrush = System.Windows.Media.SolidColorBrush;
|
||||
|
||||
namespace Artemis.UI.Shared
|
||||
@ -14,10 +15,10 @@ namespace Artemis.UI.Shared
|
||||
{
|
||||
private const byte Dimmed = 100;
|
||||
private const byte NonDimmed = 255;
|
||||
private Color _renderColor;
|
||||
private GeometryDrawing? _geometryDrawing;
|
||||
private SolidColorBrush? _renderColorBrush;
|
||||
private DrawingGroup? _lastBackingStore;
|
||||
private Color _renderColor;
|
||||
private SolidColorBrush? _renderColorBrush;
|
||||
|
||||
public DeviceVisualizerLed(ArtemisLed led)
|
||||
{
|
||||
@ -48,7 +49,7 @@ namespace Artemis.UI.Shared
|
||||
|
||||
_renderColorBrush ??= new SolidColorBrush();
|
||||
_geometryDrawing ??= new GeometryDrawing(_renderColorBrush, null, new RectangleGeometry(LedRect));
|
||||
|
||||
|
||||
byte r = Led.RgbLed.Color.GetR();
|
||||
byte g = Led.RgbLed.Color.GetG();
|
||||
byte b = Led.RgbLed.Color.GetB();
|
||||
@ -64,7 +65,6 @@ namespace Artemis.UI.Shared
|
||||
backingStore.Children.Add(_geometryDrawing);
|
||||
_lastBackingStore = backingStore;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RenderImage(DrawingContext drawingContext)
|
||||
@ -95,6 +95,20 @@ namespace Artemis.UI.Shared
|
||||
drawingContext.Pop();
|
||||
}
|
||||
|
||||
public bool HitTest(Point position)
|
||||
{
|
||||
if (DisplayGeometry == null)
|
||||
return false;
|
||||
|
||||
PathGeometry translatedGeometry = Geometry.Combine(
|
||||
Geometry.Empty,
|
||||
DisplayGeometry,
|
||||
GeometryCombineMode.Union,
|
||||
new TranslateTransform(Led.RgbLed.Location.X, Led.RgbLed.Location.Y)
|
||||
);
|
||||
return translatedGeometry.FillContains(position);
|
||||
}
|
||||
|
||||
private void CreateLedGeometry()
|
||||
{
|
||||
// The minimum required size for geometry to be created
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user