mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Applied Led-Position-Fix from #331 to Corsair-Legacy-DeviceProvider
This commit is contained in:
parent
8faedd1e26
commit
2a2053cc53
@ -2,6 +2,7 @@
|
|||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.CorsairLegacy.Native;
|
using RGB.NET.Devices.CorsairLegacy.Native;
|
||||||
@ -59,6 +60,21 @@ public class CorsairCustomRGBDevice : CorsairRGBDevice<CorsairCustomRGBDeviceInf
|
|||||||
|
|
||||||
ptr = new IntPtr(ptr.ToInt64() + structSize);
|
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)
|
private static LedId GetReferenceLed(RGBDeviceType deviceType)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user