block user input while we are in another user interaction

Change-Id: I25a846b0648d2d28585a58066a9bb1088d607c24
This commit is contained in:
Markus Mohrhard
2014-05-26 03:11:22 +02:00
committed by Markus Mohrhard
parent b8dc914cdc
commit 257510bffb
2 changed files with 16 additions and 1 deletions

View File

@@ -34,7 +34,8 @@ GL3DBarChart::GL3DBarChart(
mpTextCache(new opengl3D::TextCache()), mpTextCache(new opengl3D::TextCache()),
mnStep(0), mnStep(0),
mnStepsTotal(0), mnStepsTotal(0),
mnCornerId(0) mnCornerId(0),
mbBlockUserInput(false)
{ {
Size aSize = mrWindow.GetSizePixel(); Size aSize = mrWindow.GetSizePixel();
mpRenderer->SetSize(aSize); mpRenderer->SetSize(aSize);
@@ -307,6 +308,10 @@ public:
void GL3DBarChart::clickedAt(const Point& /*rPos*/) void GL3DBarChart::clickedAt(const Point& /*rPos*/)
{ {
if(mbBlockUserInput)
return;
mbBlockUserInput = true;
sal_uInt32 nId = 5; sal_uInt32 nId = 5;
/* /*
{ {
@@ -344,6 +349,10 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/)
void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons) void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons)
{ {
if(mbBlockUserInput)
return;
mbBlockUserInput = true;
SAL_WARN("chart2.opengl", "Dragging: " << rStartPos << " to : " << rEndPos << " Buttons: " << nButtons); SAL_WARN("chart2.opengl", "Dragging: " << rStartPos << " to : " << rEndPos << " Buttons: " << nButtons);
if(nButtons == MOUSE_RIGHT) if(nButtons == MOUSE_RIGHT)
{ {
@@ -413,6 +422,7 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveCamera)
} }
else else
{ {
mbBlockUserInput = false;
mnStep = 0; mnStep = 0;
} }
@@ -434,6 +444,7 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveToBar)
else else
{ {
maShapes.pop_back(); maShapes.pop_back();
mbBlockUserInput = false;
mnStep = 0; mnStep = 0;
} }
@@ -442,6 +453,9 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveToBar)
void GL3DBarChart::scroll(long nDelta) void GL3DBarChart::scroll(long nDelta)
{ {
if(mbBlockUserInput)
return;
glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection); glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection);
maCameraPosition -= (float((nDelta/10)) * maDir); maCameraPosition -= (float((nDelta/10)) * maDir);
mpCamera->setPosition(maCameraPosition); mpCamera->setPosition(maCameraPosition);

View File

@@ -107,6 +107,7 @@ private:
std::map<sal_uInt32, const BarInformation> maBarMap; std::map<sal_uInt32, const BarInformation> maBarMap;
bool mbBlockUserInput;
}; };
} }