mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Visualization - Refactor mouse click handling logic for improved double-click detection (#385)
This commit is contained in:
parent
79198f7297
commit
4556423a04
@ -695,8 +695,21 @@ bool AIS_ViewController::UpdateMouseButtons(const Graphic3d_Vec2i& thePoint,
|
|||||||
if (double(aDelta.cwiseAbs().maxComp()) < aTolClick)
|
if (double(aDelta.cwiseAbs().maxComp()) < aTolClick)
|
||||||
{
|
{
|
||||||
++myMouseClickCounter;
|
++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.Stop();
|
||||||
myMouseClickTimer.Reset();
|
myMouseClickTimer.Reset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user