From 09c266f25256d25103781e74038fc5265b957459 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 5 Sep 2012 18:44:53 +0100 Subject: [PATCH] Perform pointtranslate (zoom) only in GameView. Fixes point line issue in #175 --- src/game/GameController.cpp | 10 +++++----- src/game/GameView.cpp | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 860c23ad7..fd6465484 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -374,7 +374,7 @@ void GameController::DrawRect(int toolSelection, ui::Point point1, ui::Point poi if(!activeTool || !cBrush) return; 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) @@ -386,7 +386,7 @@ void GameController::DrawLine(int toolSelection, ui::Point point1, ui::Point poi if(!activeTool || !cBrush) return; 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) @@ -398,7 +398,7 @@ void GameController::DrawFill(int toolSelection, ui::Point point) if(!activeTool || !cBrush) return; activeTool->SetStrength(gameModel->GetToolStrength()); - activeTool->DrawFill(sim, cBrush, PointTranslate(point)); + activeTool->DrawFill(sim, cBrush, point); } void GameController::DrawPoints(int toolSelection, queue & pointQueue) @@ -427,7 +427,7 @@ void GameController::DrawPoints(int toolSelection, queue & pointQueu bool first = true; while(!pointQueue.empty()) { - ui::Point fPoint = PointTranslate(*pointQueue.front()); + ui::Point fPoint = *pointQueue.front(); delete pointQueue.front(); pointQueue.pop(); if(!first) @@ -480,7 +480,7 @@ void GameController::ToolClick(int toolSelection, ui::Point point) Brush * cBrush = gameModel->GetBrush(); if(!activeTool || !cBrush) return; - activeTool->Click(sim, cBrush, PointTranslate(point)); + activeTool->Click(sim, cBrush, point); } void GameController::StampRegion(ui::Point point1, ui::Point point2) diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 3955c6745..a05e7ef2a 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -981,8 +981,8 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy) currentMouse = ui::Point(x, y); if(isMouseDown && drawMode == DrawPoints) { - pointQueue.push(new ui::Point(x-dx, y-dy)); - pointQueue.push(new ui::Point(x, y)); + pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy)))); + 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) { - 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) { - finalDrawPoint2 = lineSnapCoords(drawPoint1, drawPoint2); + finalDrawPoint2 = c->PointTranslate(lineSnapCoords(c->PointTranslate(drawPoint1), drawPoint2)); } if(drawSnap && drawMode == DrawRect) { - finalDrawPoint2 = rectSnapCoords(drawPoint1, drawPoint2); + finalDrawPoint2 = c->PointTranslate(rectSnapCoords(c->PointTranslate(drawPoint1), drawPoint2)); } if(drawMode == DrawRect) { - c->DrawRect(toolIndex, drawPoint1, finalDrawPoint2); + c->DrawRect(toolIndex, c->PointTranslate(drawPoint1), finalDrawPoint2); } if(drawMode == DrawLine) { - c->DrawLine(toolIndex, drawPoint1, finalDrawPoint2); + c->DrawLine(toolIndex, c->PointTranslate(drawPoint1), finalDrawPoint2); } } 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)); } if(drawModeReset) @@ -1169,7 +1169,7 @@ void GameView::OnMouseWheel(int x, int y, int d) c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour); 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) { - pointQueue.push(new ui::Point(currentMouse)); + pointQueue.push(new ui::Point(c->PointTranslate(currentMouse))); } if(!pointQueue.empty()) { @@ -1462,7 +1462,7 @@ void GameView::OnTick(float dt) } if(drawMode == DrawFill && isMouseDown) { - c->DrawFill(toolIndex, currentMouse); + c->DrawFill(toolIndex, c->PointTranslate(currentMouse)); } if(introText) {