Perform pointtranslate (zoom) only in GameView. Fixes point line issue in #175

This commit is contained in:
Simon Robertshaw 2012-09-05 18:44:53 +01:00
parent 98725dea26
commit 09c266f252
2 changed files with 16 additions and 16 deletions

View File

@ -374,7 +374,7 @@ void GameController::DrawRect(int toolSelection, ui::Point point1, ui::Point poi
if(!activeTool || !cBrush) if(!activeTool || !cBrush)
return; return;
activeTool->SetStrength(gameModel->GetToolStrength()); activeTool->SetStrength(gameModel->GetToolStrength());
activeTool->DrawRect(sim, cBrush, PointTranslate(point1), PointTranslate(point2)); activeTool->DrawRect(sim, cBrush, point1, point2);
} }
void GameController::DrawLine(int toolSelection, ui::Point point1, ui::Point point2) void GameController::DrawLine(int toolSelection, ui::Point point1, ui::Point point2)
@ -386,7 +386,7 @@ void GameController::DrawLine(int toolSelection, ui::Point point1, ui::Point poi
if(!activeTool || !cBrush) if(!activeTool || !cBrush)
return; return;
activeTool->SetStrength(gameModel->GetToolStrength()); activeTool->SetStrength(gameModel->GetToolStrength());
activeTool->DrawLine(sim, cBrush, PointTranslate(point1), PointTranslate(point2)); activeTool->DrawLine(sim, cBrush, point1, point2);
} }
void GameController::DrawFill(int toolSelection, ui::Point point) void GameController::DrawFill(int toolSelection, ui::Point point)
@ -398,7 +398,7 @@ void GameController::DrawFill(int toolSelection, ui::Point point)
if(!activeTool || !cBrush) if(!activeTool || !cBrush)
return; return;
activeTool->SetStrength(gameModel->GetToolStrength()); activeTool->SetStrength(gameModel->GetToolStrength());
activeTool->DrawFill(sim, cBrush, PointTranslate(point)); activeTool->DrawFill(sim, cBrush, point);
} }
void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueue) void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueue)
@ -427,7 +427,7 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueu
bool first = true; bool first = true;
while(!pointQueue.empty()) while(!pointQueue.empty())
{ {
ui::Point fPoint = PointTranslate(*pointQueue.front()); ui::Point fPoint = *pointQueue.front();
delete pointQueue.front(); delete pointQueue.front();
pointQueue.pop(); pointQueue.pop();
if(!first) if(!first)
@ -480,7 +480,7 @@ void GameController::ToolClick(int toolSelection, ui::Point point)
Brush * cBrush = gameModel->GetBrush(); Brush * cBrush = gameModel->GetBrush();
if(!activeTool || !cBrush) if(!activeTool || !cBrush)
return; return;
activeTool->Click(sim, cBrush, PointTranslate(point)); activeTool->Click(sim, cBrush, point);
} }
void GameController::StampRegion(ui::Point point1, ui::Point point2) void GameController::StampRegion(ui::Point point1, ui::Point point2)

View File

@ -981,8 +981,8 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
currentMouse = ui::Point(x, y); currentMouse = ui::Point(x, y);
if(isMouseDown && drawMode == DrawPoints) if(isMouseDown && drawMode == DrawPoints)
{ {
pointQueue.push(new ui::Point(x-dx, y-dy)); pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy))));
pointQueue.push(new ui::Point(x, y)); pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
} }
} }
@ -1014,7 +1014,7 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
} }
if(drawMode == DrawPoints) if(drawMode == DrawPoints)
{ {
pointQueue.push(new ui::Point(x, y)); pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
} }
} }
} }
@ -1082,26 +1082,26 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
if(drawSnap && drawMode == DrawLine) if(drawSnap && drawMode == DrawLine)
{ {
finalDrawPoint2 = lineSnapCoords(drawPoint1, drawPoint2); finalDrawPoint2 = c->PointTranslate(lineSnapCoords(c->PointTranslate(drawPoint1), drawPoint2));
} }
if(drawSnap && drawMode == DrawRect) if(drawSnap && drawMode == DrawRect)
{ {
finalDrawPoint2 = rectSnapCoords(drawPoint1, drawPoint2); finalDrawPoint2 = c->PointTranslate(rectSnapCoords(c->PointTranslate(drawPoint1), drawPoint2));
} }
if(drawMode == DrawRect) if(drawMode == DrawRect)
{ {
c->DrawRect(toolIndex, drawPoint1, finalDrawPoint2); c->DrawRect(toolIndex, c->PointTranslate(drawPoint1), finalDrawPoint2);
} }
if(drawMode == DrawLine) if(drawMode == DrawLine)
{ {
c->DrawLine(toolIndex, drawPoint1, finalDrawPoint2); c->DrawLine(toolIndex, c->PointTranslate(drawPoint1), finalDrawPoint2);
} }
} }
if(drawMode == DrawPoints) if(drawMode == DrawPoints)
{ {
c->ToolClick(toolIndex, ui::Point(x, y)); c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y)));
//pointQueue.push(new ui::Point(x, y)); //pointQueue.push(new ui::Point(x, y));
} }
if(drawModeReset) if(drawModeReset)
@ -1169,7 +1169,7 @@ void GameView::OnMouseWheel(int x, int y, int d)
c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour); c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour);
if(isMouseDown) if(isMouseDown)
{ {
pointQueue.push(new ui::Point(x, y)); pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
} }
} }
} }
@ -1453,7 +1453,7 @@ void GameView::OnTick(float dt)
{ {
if(isMouseDown) if(isMouseDown)
{ {
pointQueue.push(new ui::Point(currentMouse)); pointQueue.push(new ui::Point(c->PointTranslate(currentMouse)));
} }
if(!pointQueue.empty()) if(!pointQueue.empty())
{ {
@ -1462,7 +1462,7 @@ void GameView::OnTick(float dt)
} }
if(drawMode == DrawFill && isMouseDown) if(drawMode == DrawFill && isMouseDown)
{ {
c->DrawFill(toolIndex, currentMouse); c->DrawFill(toolIndex, c->PointTranslate(currentMouse));
} }
if(introText) if(introText)
{ {