Exemplo n.º 1
0
 /// <summary>
 /// Gets a list of <see cref="CorsairLed" /> inside the given rectangle.
 /// </summary>
 /// <param name="referenceRect">The rectangle to check.</param>
 /// <param name="minOverlayPercentage">The minimal percentage overlay a location must have with the <see cref="Rectangle" /> to be taken into the list.</param>
 /// <returns></returns>
 public IEnumerable <CorsairLed> this[RectangleF referenceRect, float minOverlayPercentage = 0.5f] => LedMapping.Values
 .Where(x => RectangleHelper.CalculateIntersectPercentage(x.LedRectangle, referenceRect) >= minOverlayPercentage);
Exemplo n.º 2
0
 /// <summary>
 /// Gets a list containing all LEDs of this group.
 /// </summary>
 /// <returns>The list containing all LEDs of this group.</returns>
 public override IEnumerable <CorsairLed> GetLeds()
 {
     return(_ledCache ?? (_ledCache = Device.Where(x => RectangleHelper.CalculateIntersectPercentage(x.LedRectangle, Rectangle) >= MinOverlayPercentage).ToList()));
 }