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

Merge pull request #345 from DarthAffe/SDK/CorsairLegacy

Applied Led-Position-Fix from #331 to Corsair-Legacy-DeviceProvider
This commit is contained in:
DarthAffe 2023-07-25 22:19:41 +02:00 committed by GitHub
commit b4bbc6a343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
// ReSharper disable UnusedMember.Global
using System;
using System.Linq;
using System.Runtime.InteropServices;
using RGB.NET.Core;
using RGB.NET.Devices.CorsairLegacy.Native;
@ -59,6 +60,21 @@ public class CorsairCustomRGBDevice : CorsairRGBDevice<CorsairCustomRGBDeviceInf
ptr = new IntPtr(ptr.ToInt64() + structSize);
}
if (DeviceInfo.LedOffset > 0)
FixOffsetDeviceLayout();
}
/// <summary>
/// Fixes the locations for devices split by offset by aligning them to the top left.
/// </summary>
protected virtual void FixOffsetDeviceLayout()
{
float minX = this.Min(x => x.Location.X);
float minY = this.Min(x => x.Location.Y);
foreach (Led led in this)
led.Location = led.Location.Translate(-minX, -minY);
}
private static LedId GetReferenceLed(RGBDeviceType deviceType)