Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseEditorUIComponent.c
Go to the documentation of this file.
1 
4 {
5  const int CANCEL_CLICK_MAX_DIS = 5; //--- Maximum distance in reference resolution pixels for RMB cancel action to be accepted
6  const int CANCEL_CLICK_MAX_TIME = 500; //--- Maximum duration in miliseconds for RMB cancel action to be accepted
7 
8  protected vector m_vClickPosCancel;
9 
10  protected vector OnCancelDown()
11  {
12  /*
13  SCR_ManualCamera camera = SCR_CameraEditorComponent.GetCameraInstance();
14  if (camera)
15  {
16  SCR_ManualCameraParam param = camera.GetCameraParam();
17  if (param && param.isManualInput)
18  return vector.Zero;
19  }
20  */
21 
22  WorkspaceWidget workspace = GetGame().GetWorkspace();
23  if (!workspace)
24  return vector.Zero;
25 
26  ScriptCallQueue queue = GetGame().GetCallqueue();
27  if (queue) queue.CallLater(OnCancelExpired, CANCEL_CLICK_MAX_TIME);
28 
29  int mouseX, mouseY;
30  WidgetManager.GetMousePos(mouseX, mouseY);
31  m_vClickPosCancel = Vector(workspace.DPIUnscale(mouseX), workspace.DPIUnscale(mouseY), 0);
32  return m_vClickPosCancel;
33  }
34  protected bool OnCancelUp()
35  {
36  /*
37  SCR_ManualCamera camera = SCR_CameraEditorComponent.GetCameraInstance();
38  if (camera)
39  {
40  SCR_ManualCameraParam param = camera.GetCameraParam();
41  if (param && param.isManualInput)
42  return false;
43  }
44  */
45 
46  WorkspaceWidget workspace = GetGame().GetWorkspace();
47  if (!workspace)
48  return false;
49 
50  int mouseX, mouseY;
51  WidgetManager.GetMousePos(mouseX, mouseY);
52  vector mousePos = Vector(workspace.DPIUnscale(mouseX), workspace.DPIUnscale(mouseY), 0);
53  return vector.Distance(m_vClickPosCancel, mousePos) < CANCEL_CLICK_MAX_DIS;
54  }
55  protected void OnCancelExpired()
56  {
57  m_vClickPosCancel = Vector(int.MAX, int.MAX, 0);
58  }
59 };
MenuRootSubComponent
Definition: MenuRootSubComponent.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_BaseEditorUIComponent
Definition: SCR_BaseEditorUIComponent.c:3