增加命中测试等级选项
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user