Skip to content
Snippets Groups Projects
Commit aae90a8f authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added dangling drawer catch

parent abe844e7
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ DrawingHandler::~DrawingHandler() { ...@@ -42,6 +42,7 @@ DrawingHandler::~DrawingHandler() {
glDeleteBuffers(1, &vbo_); glDeleteBuffers(1, &vbo_);
glDeleteFramebuffers(1, &fbo_); glDeleteFramebuffers(1, &fbo_);
} }
void DrawingHandler::update(Toolbox& tb) { void DrawingHandler::update(Toolbox& tb) {
if (previous_mstate_ != tb.m_state) { if (previous_mstate_ != tb.m_state) {
drawpairs_.clear(); drawpairs_.clear();
...@@ -54,7 +55,6 @@ void DrawingHandler::update(Toolbox& tb) { ...@@ -54,7 +55,6 @@ void DrawingHandler::update(Toolbox& tb) {
DRAWERMESSAGE message = std::get<DRAWERMESSAGE>(m.message); DRAWERMESSAGE message = std::get<DRAWERMESSAGE>(m.message);
switch (message) { switch (message) {
case DRAWERMESSAGE::CLEAR: case DRAWERMESSAGE::CLEAR:
/*Clearing the damping is taken care of by the WaveHandler*/
drawpairs_.clear(); drawpairs_.clear();
m.handled = true; m.handled = true;
break; break;
...@@ -63,6 +63,10 @@ void DrawingHandler::update(Toolbox& tb) { ...@@ -63,6 +63,10 @@ void DrawingHandler::update(Toolbox& tb) {
} }
} }
} }
/*Catch dangling Drawers, no touches means no drawers*/
if (drawpairs_.size() > 0 && tb.current_touchIDs.size() == 0) {
drawpairs_.clear();
}
/*We can return here if MSTATE is not interesting*/ /*We can return here if MSTATE is not interesting*/
if (tb.m_state != static_cast<int>(MSTATE::DRAW) && tb.m_state != static_cast<int>(MSTATE::ERASE)) { if (tb.m_state != static_cast<int>(MSTATE::DRAW) && tb.m_state != static_cast<int>(MSTATE::ERASE)) {
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment