mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Profile editor - Only save profile on drag-edit when mouse is released
Profile editor - Format all numbers with 3 decimals Profile editor - Fixed drag-edit rounding errors with very small steps Logging - Output logs to debug Settings - Added logging level setting Nuget - Updated Serilog and the used sinks
This commit is contained in:
1 parent
05cf1f0b53
commit
318a679744
26 files changed
+323
-161
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Artemis.UI.Utilities
|
||||
{
|
||||
public static class HitTestUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs a hit test on children of the container within the rectangle matching all elements that have a data context of <see cref="T"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="rectangleGeometry"></param>
|
||||
/// <returns></returns>
|
||||
public static List<T> GetHitViewModels<T>(Visual container, RectangleGeometry rectangleGeometry)
|
||||
{
|
||||
var result = new List<T>();
|
||||
var hitTestParams = new GeometryHitTestParameters(rectangleGeometry);
|
||||
var resultCallback = new HitTestResultCallback(r => HitTestResultBehavior.Continue);
|
||||
var filterCallback = new HitTestFilterCallback(e =>
|
||||
{
|
||||
if (e is FrameworkElement fe && fe.DataContext.GetType() == typeof(T) && !result.Contains((T) fe.DataContext))
|
||||
result.Add((T) fe.DataContext);
|
||||
return HitTestFilterBehavior.Continue;
|
||||
});
|
||||
VisualTreeHelper.HitTest(container, filterCallback, resultCallback, hitTestParams);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user