Do not emit touch when no new position

This commit is contained in:
X9VoiD 2022-12-01 00:12:20 +08:00
parent 37f0471982
commit f73b73e543

View file

@ -8,6 +8,7 @@ namespace VoiDPlugins.OutputMode
private readonly TouchDevice _touchDevice;
private bool _inContact;
private bool _lastContact;
private bool _dirty;
public TouchPointerHandler()
{
@ -17,8 +18,12 @@ namespace VoiDPlugins.OutputMode
}
public void Flush()
{
if (_dirty)
{
_touchDevice.Inject();
_dirty = false;
}
}
public void Reset()
@ -28,6 +33,7 @@ namespace VoiDPlugins.OutputMode
public void SetPosition(Vector2 pos)
{
_dirty = true;
_touchDevice.SetPointerFlags(POINTER_FLAGS.INRANGE);
_touchDevice.SetPosition(new POINT((int)pos.X, (int)pos.Y));
if (_inContact != _lastContact)