/// <summary>Double click threshold in milisecond</summary>
public static int DOUBLECLICK_TRESHOLD = 320;//max duration between two mouse_down evt for a dbl clk in milisec.
/// <summary> Time to wait in millisecond before starting repeat loop</summary>
- public static int DEVICE_REPEAT_DELAY = 700;
+ public static int DEVICE_REPEAT_DELAY = 600;
/// <summary> Time interval in millisecond between device event repeat</summary>
- public static int DEVICE_REPEAT_INTERVAL = 40;
+ public static int DEVICE_REPEAT_INTERVAL = 100;
public static float WheelIncrement = 1;
/// <summary>Tabulation size in Text controls</summary>
public static int TAB_SIZE = 4;
for (int i = 0; i < tmpThreads.Length; i++)
tmpThreads [i].CheckState ();
- //if (mouseRepeatTimer.ElapsedMilliseconds > 0) {
- // if ((bool)_hoverWidget?.MouseRepeat) {
- // int repeatCount = (int)mouseRepeatTimer.ElapsedMilliseconds / DEVICE_REPEAT_INTERVAL - mouseRepeatCount;
- // for (int i = 0; i < repeatCount; i++)
- // _hoverWidget.onMouseDown (_hoverWidget, lastMouseDownEvent);
- // mouseRepeatCount += repeatCount;
- // }
- //} else if (lastMouseDown.ElapsedMilliseconds > DEVICE_REPEAT_DELAY)
- //mouseRepeatTimer.Start ();
+ if (lastMouseDownEvent != null) {
+ if (mouseRepeatTimer.ElapsedMilliseconds > DEVICE_REPEAT_INTERVAL) {
+ if (_hoverWidget != null && _hoverWidget.MouseRepeat) {
+ _hoverWidget.onMouseDown (_hoverWidget, lastMouseDownEvent);
+ mouseRepeatTimer.Restart ();
+ }
+ } else if (lastMouseDown.ElapsedMilliseconds > DEVICE_REPEAT_DELAY)
+ mouseRepeatTimer.Start ();
+ }
if (!Monitor.TryEnter (UpdateMutex))
return;
Stopwatch lastMouseDown = Stopwatch.StartNew (), mouseRepeatTimer = new Stopwatch ();
bool doubleClickTriggered; //next mouse up will trigger a double click
- //int mouseRepeatCount;
MouseButtonEventArgs lastMouseDownEvent;
public Point MousePosition { get; set; } = default;
{
doubleClickTriggered = (lastMouseDown.ElapsedMilliseconds < DOUBLECLICK_TRESHOLD);
lastMouseDown.Restart ();
- //mouseRepeatCount = -1;//stays negative until repeat delay is hit
lastMouseDownEvent = new MouseButtonEventArgs (MousePosition.X, MousePosition.Y, button, InputAction.Press);
public virtual bool OnMouseButtonUp (MouseButton button)
{
mouseRepeatTimer.Reset ();
+ lastMouseDownEvent = null;
MouseButtonEventArgs e = new MouseButtonEventArgs (MousePosition.X, MousePosition.Y, button, InputAction.Repeat);
if (_activeWidget == null)