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