1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-02 17:46:22 +03:00

Visualization - Refactor mouse click handling logic for improved double-click detection ()

This commit is contained in:
jboissy-mediasofts 2025-02-27 12:39:32 +01:00 committed by GitHub
parent 79198f7297
commit 4556423a04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -695,8 +695,21 @@ bool AIS_ViewController::UpdateMouseButtons(const Graphic3d_Vec2i& thePoint,
if (double(aDelta.cwiseAbs().maxComp()) < aTolClick)
{
++myMouseClickCounter;
const bool isDoubleClick = myMouseClickCounter == 2 && myMouseClickTimer.IsStarted()
&& myMouseClickTimer.ElapsedTime() <= myMouseDoubleClickInt;
const bool isCounterValid = myMouseClickCounter == 2;
const bool isTimerStarted = myMouseClickTimer.IsStarted();
const bool isTimerElapsed = myMouseClickTimer.ElapsedTime() > myMouseDoubleClickInt;
const bool isTimerValid = isTimerStarted && !isTimerElapsed;
const bool isDoubleClick = isCounterValid && isTimerValid;
if (!isTimerValid)
{
myMouseClickCounter = 1;
}
myMouseClickCounter %= 2;
myMouseClickTimer.Stop();
myMouseClickTimer.Reset();