1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Added ActualSize for devices

This commit is contained in:
Darth Affe 2019-11-19 15:34:47 +01:00
parent 2cf8609173
commit 59d203657e
4 changed files with 22 additions and 7 deletions

View File

@ -31,10 +31,17 @@ namespace RGB.NET.Core
/// <inheritdoc />
public Size Size
{
get => _size * Scale;
protected set => SetProperty(ref _size, value);
get => _size;
protected set
{
if (SetProperty(ref _size, value))
OnPropertyChanged(nameof(ActualSize));
}
}
/// <inheritdoc />
public Size ActualSize => Size * Scale;
private Point _location = new Point(0, 0);
/// <inheritdoc />
public Point Location
@ -51,7 +58,7 @@ namespace RGB.NET.Core
set
{
if (SetProperty(ref _scale, value))
OnPropertyChanged(nameof(Size));
OnPropertyChanged(nameof(ActualSize));
}
}

View File

@ -24,10 +24,18 @@ namespace RGB.NET.Core
Point Location { get; set; }
/// <summary>
/// Gets a copy of the <see cref="Size"/> of the whole <see cref="IRGBDevice"/>.
/// Gets the <see cref="Size"/> of the <see cref="IRGBDevice"/>.
/// </summary>
Size Size { get; }
/// <summary>
/// Gets the actual <see cref="Size"/> (scaled and rotated) of the <see cref="IRGBDevice"/>.
/// </summary>
Size ActualSize { get; }
/// <summary>
/// Gets or sets the scale of the <see cref="IRGBDevice"/>.
/// </summary>
Scale Scale { get; set; }
/// <summary>

View File

@ -226,7 +226,7 @@ namespace RGB.NET.Core
private void UpdateSurfaceRectangle()
{
Rectangle devicesRectangle = new Rectangle(_devices.Select(d => new Rectangle(d.Location, d.Size)));
Rectangle devicesRectangle = new Rectangle(_devices.Select(d => new Rectangle(d.Location, d.ActualSize)));
SurfaceRectangle = SurfaceRectangle.SetSize(new Size(devicesRectangle.Location.X + devicesRectangle.Size.Width, devicesRectangle.Location.Y + devicesRectangle.Size.Height));
}

View File

@ -63,7 +63,7 @@ namespace RGB.NET.Core
foreach (IRGBDevice device in Devices)
{
device.Location += new Point(posX, 0);
posX += device.Size.Width + 1;
posX += device.ActualSize.Width + 1;
}
}