mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-07 00:46:33 +02:00
mouse drawing triggered on mouse move, flood fill triggered on mouse down/move/up
This commit is contained in:
@@ -1075,6 +1075,12 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
|
|||||||
if (drawMode == DrawPoints)
|
if (drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
currentPoint = mousePosition;
|
currentPoint = mousePosition;
|
||||||
|
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
|
||||||
|
lastPoint = currentPoint;
|
||||||
|
}
|
||||||
|
else if (drawMode == DrawFill)
|
||||||
|
{
|
||||||
|
c->DrawFill(toolIndex, mousePosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (drawMode == DrawPoints || drawMode == DrawFill)
|
else if (drawMode == DrawPoints || drawMode == DrawFill)
|
||||||
@@ -1125,11 +1131,15 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
{
|
{
|
||||||
drawPoint1 = c->PointTranslate(currentMouse);
|
drawPoint1 = c->PointTranslate(currentMouse);
|
||||||
}
|
}
|
||||||
if (drawMode == DrawPoints)
|
else if (drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
lastPoint = currentPoint = c->PointTranslate(currentMouse);
|
lastPoint = currentPoint = c->PointTranslate(currentMouse);
|
||||||
c->DrawPoints(toolIndex, lastPoint, currentPoint, false);
|
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)
|
// plop tool stuff (like STKM)
|
||||||
c->ToolClick(toolIndex, finalDrawPoint2);
|
c->ToolClick(toolIndex, finalDrawPoint2);
|
||||||
}
|
}
|
||||||
|
else if (drawMode == DrawFill)
|
||||||
|
{
|
||||||
|
c->DrawFill(toolIndex, finalDrawPoint2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// this shouldn't happen, but do this just in case
|
// this shouldn't happen, but do this just in case
|
||||||
else if (selectMode != SelectNone && button != BUTTON_LEFT)
|
else if (selectMode != SelectNone && button != BUTTON_LEFT)
|
||||||
@@ -1599,21 +1613,18 @@ void GameView::OnTick(float dt)
|
|||||||
selectMode = SelectNone;
|
selectMode = SelectNone;
|
||||||
if (zoomEnabled && !zoomCursorFixed)
|
if (zoomEnabled && !zoomCursorFixed)
|
||||||
c->SetZoomPosition(currentMouse);
|
c->SetZoomPosition(currentMouse);
|
||||||
if (selectMode == SelectNone)
|
if (selectMode == SelectNone && isMouseDown)
|
||||||
{
|
{
|
||||||
if (drawMode == DrawPoints)
|
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));
|
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));
|
c->DrawLine(toolIndex, c->PointTranslate(drawPoint1), lineSnapCoords(c->PointTranslate(drawPoint1), currentMouse));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user