Increase dragging dead zone (#7416)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Client.Outline;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
@@ -11,6 +12,7 @@ using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -30,6 +32,7 @@ namespace Content.Client.DragDrop
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfgMan = default!;
|
||||
[Dependency] private readonly InteractionOutlineSystem _outline = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
@@ -75,6 +78,7 @@ namespace Content.Client.DragDrop
|
||||
UpdatesOutsidePrediction = true;
|
||||
|
||||
_dragDropHelper = new DragDropHelper<EntityUid>(OnBeginDrag, OnContinueDrag, OnEndDrag);
|
||||
_cfgMan.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true);
|
||||
|
||||
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
||||
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
|
||||
@@ -84,8 +88,14 @@ namespace Content.Client.DragDrop
|
||||
.Register<DragDropSystem>();
|
||||
}
|
||||
|
||||
private void SetDeadZone(float deadZone)
|
||||
{
|
||||
_dragDropHelper.Deadzone = deadZone;
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
_cfgMan.UnsubValueChanged(CCVars.DragDropDeadZone, SetDeadZone);
|
||||
_dragDropHelper.EndDrag();
|
||||
CommandBinds.Unregister<DragDropSystem>();
|
||||
base.Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user