mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
update last tool and drawMode when clicking too, fixes some issues
This commit is contained in:
@@ -1061,6 +1061,11 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
|
|||||||
((PropertyTool *)tool)->OpenWindow(gameModel->GetSimulation());
|
((PropertyTool *)tool)->OpenWindow(gameModel->GetSimulation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameController::SetLastTool(Tool * tool)
|
||||||
|
{
|
||||||
|
gameModel->SetLastTool(tool);
|
||||||
|
}
|
||||||
|
|
||||||
int GameController::GetReplaceModeFlags()
|
int GameController::GetReplaceModeFlags()
|
||||||
{
|
{
|
||||||
return gameModel->GetSimulation()->replaceModeFlags;
|
return gameModel->GetSimulation()->replaceModeFlags;
|
||||||
|
@@ -105,6 +105,7 @@ public:
|
|||||||
std::vector<Menu*> GetMenuList();
|
std::vector<Menu*> GetMenuList();
|
||||||
Tool * GetActiveTool(int selection);
|
Tool * GetActiveTool(int selection);
|
||||||
void SetActiveTool(int toolSelection, Tool * tool);
|
void SetActiveTool(int toolSelection, Tool * tool);
|
||||||
|
void SetLastTool(Tool * tool);
|
||||||
int GetReplaceModeFlags();
|
int GetReplaceModeFlags();
|
||||||
void SetReplaceModeFlags(int flags);
|
void SetReplaceModeFlags(int flags);
|
||||||
void ActiveToolChanged(int toolSelection, Tool *tool);
|
void ActiveToolChanged(int toolSelection, Tool *tool);
|
||||||
|
@@ -1122,12 +1122,17 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
}
|
}
|
||||||
if (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
if (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
||||||
{
|
{
|
||||||
|
// update tool index, set new "last" tool so GameView can detect certain tools properly
|
||||||
if (button == BUTTON_LEFT)
|
if (button == BUTTON_LEFT)
|
||||||
toolIndex = 0;
|
toolIndex = 0;
|
||||||
if (button == BUTTON_RIGHT)
|
if (button == BUTTON_RIGHT)
|
||||||
toolIndex = 1;
|
toolIndex = 1;
|
||||||
if (button == BUTTON_MIDDLE)
|
if (button == BUTTON_MIDDLE)
|
||||||
toolIndex = 2;
|
toolIndex = 2;
|
||||||
|
Tool *lastTool = c->GetActiveTool(toolIndex);
|
||||||
|
c->SetLastTool(lastTool);
|
||||||
|
UpdateDrawMode();
|
||||||
|
|
||||||
isMouseDown = true;
|
isMouseDown = true;
|
||||||
c->HistorySnapshot();
|
c->HistorySnapshot();
|
||||||
if (drawMode == DrawRect || drawMode == DrawLine)
|
if (drawMode == DrawRect || drawMode == DrawLine)
|
||||||
|
Reference in New Issue
Block a user