增加命中测试等级选项

This commit is contained in:
ww-rm
2025-10-02 10:32:24 +08:00
parent 0d72d8749a
commit 7e99882fbf
9 changed files with 106 additions and 142 deletions

View File

@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Spine.Interfaces;
using SpineViewer.Services;
using System;
using System.Collections.Generic;
@@ -89,7 +90,7 @@ namespace SpineViewer.Models
private bool _renderSelectedOnly;
[ObservableProperty]
private bool _usePreciseHitTest;
private HitTestLevel _hitTestLevel;
[ObservableProperty]
private bool _logHitSlots;

View File

@@ -429,19 +429,11 @@ namespace SpineViewer.Models
}
/// <summary>
/// 命中检测, 可选是否使用精确检测, 会有性能损失
/// 命中检测
/// </summary>
public bool HitTest(float x, float y, bool precise = false)
public bool HitTest(float x, float y)
{
lock (_lock) return _spineObject.Skeleton.HitTest(x, y, precise);
}
/// <summary>
/// 完整的命中检测, 会检测所有插槽是否命中并返回命中的插槽名称
/// </summary>
public string[] HitTestFull(float x, float y, bool precise = false)
{
lock (_lock) return _spineObject.Skeleton.HitTestFull(x, y, precise).Select(v => v.Name).ToArray();
lock (_lock) return _spineObject.Skeleton.HitTest(x, y);
}
public SpineObjectConfigModel ObjectConfig