Skip to content

Commit

Permalink
Let's make behaviour of deselectConstellations() method more aggressive
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Jul 10, 2018
1 parent f464e03 commit e6670a2
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/core/modules/ConstellationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,24 +266,38 @@ void ConstellationMgr::selectedObjectChange(StelModule::StelModuleSelectAction a

void ConstellationMgr::deselectConstellations(void)
{
selected.clear();
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(omgr);
const QList<StelObjectP> currSelection = omgr->getSelectedObject();
if (currSelection.empty())
if (getFlagIsolateSelected())
{
return;
}
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(omgr);

QList<StelObjectP> newSelection;
for (const auto& obj : currSelection)
{
if (obj->getType() != "Constellation")
// The list of selected constellations is empty, but...
if (selected.size()==0)
{
newSelection.push_back(obj);
// ...let's unselect all constellations for guarantee
for (auto* constellation : constellations)
{
constellation->setFlagLines(false);
constellation->setFlagLabels(false);
constellation->setFlagArt(false);
constellation->setFlagBoundaries(false);
}
}

// If any constellation is selected at the moment, then let's do not touch to it!
if (omgr->getWasSelected())
selected.pop_back();

// Let's hide all previously selected constellations
for (auto* constellation : selected)
{
constellation->setFlagLines(false);
constellation->setFlagLabels(false);
constellation->setFlagArt(false);
constellation->setFlagBoundaries(false);
}
selected.clear();
}
omgr->setSelectedObject(newSelection, StelModule::ReplaceSelection);
}

void ConstellationMgr::setLinesColor(const Vec3f& color)
Expand Down

0 comments on commit e6670a2

Please sign in to comment.