Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DoubleClickAction.c
Go to the documentation of this file.
2 {
3  [Attribute("1", desc: "When enabled, action will not be performed if its shotcut is mouse double-click and mouse moved between two clicks.")]
4  protected bool m_bIsDoubleClick;
5 
6  protected const string LMB_ACTION = "MouseLeft";
7  protected const int MAX_CURSOR_DIST_SQ = 100;
8 
9  protected vector m_vMouseLeftPos;
10 
11  protected void CachePosition()
12  {
13  m_vMouseLeftPos = GetMousePosVector();
14  }
15  protected void OnLMB()
16  {
17  GetGame().GetCallqueue().CallLater(CachePosition, 1);
18  }
19  protected vector GetMousePosVector()
20  {
21  int mouseX, mouseY;
22  WidgetManager.GetMousePos(mouseX, mouseY);
23  return Vector(mouseX, mouseY, 0);
24  }
25  protected bool DidCursorMoveDuringDoubleClick()
26  {
27  if (!m_bIsDoubleClick || !GetGame().GetInputManager().IsUsingMouseAndKeyboard() || m_vMouseLeftPos == vector.Zero)
28  return false;
29 
30  bool didMove = vector.DistanceSq(m_vMouseLeftPos, GetMousePosVector()) > MAX_CURSOR_DIST_SQ;
31  m_vMouseLeftPos = vector.Zero;
32  return didMove;
33  }
34 
35  override void AddShortcut(SCR_BaseActionsEditorComponent actionsManager)
36  {
37  super.AddShortcut(actionsManager);
38 
39  if (m_ActionsManager)
40  GetGame().GetInputManager().AddActionListener(LMB_ACTION, EActionTrigger.DOWN, OnLMB);
41  }
42  override void RemoveShortcut()
43  {
44  if (m_ActionsManager)
45  GetGame().GetInputManager().RemoveActionListener(LMB_ACTION, EActionTrigger.DOWN, OnLMB);
46 
47  super.RemoveShortcut();
48  }
49 };
SCR_BaseEditorAction
Definition: SCR_BaseEditorAction.c:24
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
SCR_DoubleClickAction
Definition: SCR_DoubleClickAction.c:1