Mercurial > hg > orthanc-stone
diff Framework/Scene2DViewport/OneGesturePointerTracker.cpp @ 722:28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
tools are now handled by the ViewportController. Multi-touch does not crash
trackers anymore.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 21 May 2019 10:27:54 +0200 |
parents | f45fca2ebd10 |
children | c0fcb2757b0a |
line wrap: on
line diff
--- a/Framework/Scene2DViewport/OneGesturePointerTracker.cpp Mon May 20 12:49:29 2019 +0200 +++ b/Framework/Scene2DViewport/OneGesturePointerTracker.cpp Tue May 21 10:27:54 2019 +0200 @@ -23,6 +23,8 @@ #include <Core/OrthancException.h> +#include <Framework/StoneException.h> + using namespace Orthanc; namespace OrthancStone @@ -31,17 +33,30 @@ ViewportControllerWPtr controllerW) : controllerW_(controllerW) , alive_(true) + , currentTouchCount_(1) { } void OneGesturePointerTracker::PointerUp(const PointerEvent& event) { - alive_ = false; + // pointer up is only called for the LAST up event in case of a multi-touch + // gesture + ORTHANC_ASSERT(currentTouchCount_ > 0, "Wrong state in tracker"); + currentTouchCount_--; + LOG(INFO) << "currentTouchCount_ becomes: " << currentTouchCount_; + if (currentTouchCount_ == 0) + { + LOG(INFO) << "currentTouchCount_ == 0 --> alive_ = false"; + alive_ = false; + } } void OneGesturePointerTracker::PointerDown(const PointerEvent& event) { - throw OrthancException(ErrorCode_InternalError, "Wrong state in tracker"); + // additional touches are not taken into account but we need to count + // the number of active touches + currentTouchCount_++; + LOG(INFO) << "currentTouchCount_ becomes: " << currentTouchCount_; } bool OneGesturePointerTracker::IsAlive() const