Fix bug with line tool while WIND is selected (id:2554353)

This commit is contained in:
jacob1 2020-06-14 15:23:16 -04:00
parent a9f07dc5b0
commit 688b4bec30

View File

@ -487,37 +487,27 @@ bool GameView::GetPlacingZoom()
void GameView::NotifyActiveToolsChanged(GameModel * sender)
{
decoBrush = false;
for (size_t i = 0; i < toolButtons.size(); i++)
{
auto *tool = toolButtons[i]->tool;
// Primary
if (sender->GetActiveTool(0) == tool)
{
toolButtons[i]->SetSelectionState(0); //Primary
windTool = tool->GetIdentifier() == "DEFAULT_UI_WIND";
if (sender->GetActiveTool(0)->GetIdentifier().BeginsWith("DEFAULT_DECOR_"))
decoBrush = true;
}
toolButtons[i]->SetSelectionState(0);
// Secondary
else if (sender->GetActiveTool(1) == tool)
{
toolButtons[i]->SetSelectionState(1); //Secondary
if (sender->GetActiveTool(1)->GetIdentifier().BeginsWith("DEFAULT_DECOR_"))
decoBrush = true;
}
toolButtons[i]->SetSelectionState(1);
// Tertiary
else if (sender->GetActiveTool(2) == tool)
{
toolButtons[i]->SetSelectionState(2); //Tertiary
}
toolButtons[i]->SetSelectionState(2);
// Replace Mode
else if (sender->GetActiveTool(3) == tool)
{
toolButtons[i]->SetSelectionState(3); //Replace Mode
}
toolButtons[i]->SetSelectionState(3);
// Not selected at all
else
{
toolButtons[i]->SetSelectionState(-1);
}
}
decoBrush = sender->GetActiveTool(0)->GetIdentifier().BeginsWith("DEFAULT_DECOR_");
if (sender->GetRenderer()->findingElement)
{
@ -1037,6 +1027,9 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
return;
Tool *lastTool = c->GetActiveTool(toolIndex);
c->SetLastTool(lastTool);
windTool = lastTool->GetIdentifier() == "DEFAULT_UI_WIND";
decoBrush = lastTool->GetIdentifier().BeginsWith("DEFAULT_DECOR_");
UpdateDrawMode();
isMouseDown = true;