Permalink
Browse files

mouse drawing triggered on mouse move, flood fill triggered on mouse …

…down/move/up
  • Loading branch information...
jacob1 committed Sep 25, 2015
1 parent 610cd82 commit b2840de173eee1ce1dea0b62068f61c90277d2ee
Showing with 20 additions and 9 deletions.
  1. +20 −9 src/gui/game/GameView.cpp
@@ -1075,6 +1075,12 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
if (drawMode == DrawPoints)
{
currentPoint = mousePosition;
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
lastPoint = currentPoint;
}
else if (drawMode == DrawFill)
{
c->DrawFill(toolIndex, mousePosition);
}
}
else if (drawMode == DrawPoints || drawMode == DrawFill)
@@ -1125,11 +1131,15 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
{
drawPoint1 = c->PointTranslate(currentMouse);
}
if (drawMode == DrawPoints)
else if (drawMode == DrawPoints)
{
lastPoint = currentPoint = c->PointTranslate(currentMouse);
c->DrawPoints(toolIndex, lastPoint, currentPoint, false);
}
else if (drawMode == DrawFill)
{
c->DrawFill(toolIndex, c->PointTranslate(currentMouse));
}
}
}
}
@@ -1217,6 +1227,10 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
// plop tool stuff (like STKM)
c->ToolClick(toolIndex, finalDrawPoint2);
}
else if (drawMode == DrawFill)
{
c->DrawFill(toolIndex, finalDrawPoint2);
}
}
// this shouldn't happen, but do this just in case
else if (selectMode != SelectNone && button != BUTTON_LEFT)
@@ -1599,21 +1613,18 @@ void GameView::OnTick(float dt)
selectMode = SelectNone;
if (zoomEnabled && !zoomCursorFixed)
c->SetZoomPosition(currentMouse);
if (selectMode == SelectNone)
if (selectMode == SelectNone && isMouseDown)
{
if (drawMode == DrawPoints)
{
if (isMouseDown)
{
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
lastPoint = currentPoint;
}
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
lastPoint = currentPoint;
}
else if (drawMode == DrawFill && isMouseDown)
else if (drawMode == DrawFill)
{
c->DrawFill(toolIndex, c->PointTranslate(currentMouse));
}
else if (windTool && isMouseDown && drawMode == DrawLine)
else if (windTool && drawMode == DrawLine)
{
c->DrawLine(toolIndex, c->PointTranslate(drawPoint1), lineSnapCoords(c->PointTranslate(drawPoint1), currentMouse));
}

0 comments on commit b2840de

Please sign in to comment.