5 const int CANCEL_CLICK_MAX_DIS = 5;
6 const int CANCEL_CLICK_MAX_TIME = 500;
8 protected vector m_vClickPosCancel;
10 protected vector OnCancelDown()
22 WorkspaceWidget workspace =
GetGame().GetWorkspace();
26 ScriptCallQueue queue =
GetGame().GetCallqueue();
27 if (queue) queue.CallLater(OnCancelExpired, CANCEL_CLICK_MAX_TIME);
30 WidgetManager.GetMousePos(mouseX, mouseY);
31 m_vClickPosCancel = Vector(workspace.DPIUnscale(mouseX), workspace.DPIUnscale(mouseY), 0);
32 return m_vClickPosCancel;
34 protected bool OnCancelUp()
46 WorkspaceWidget workspace =
GetGame().GetWorkspace();
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;
55 protected void OnCancelExpired()
57 m_vClickPosCancel = Vector(
int.MAX,
int.MAX, 0);