Commit ca46e09f authored by Robin Eschbach's avatar Robin Eschbach
Browse files

Merge branch 'top2021s6/#149_single_fibers' into 'sprint_6'

[MERGE #149] remove fibers with only one point

See merge request top/21s/sivert-vis/sivert-vis-project!99
parents 1a432df9 b87af971
......@@ -215,7 +215,7 @@ void WFiberHandler::addFiberAt( std::string name, size_t position, bool hidden,
}
}
void WFiberHandler::removeFiber( size_t idx, bool silent )
void WFiberHandler::removeFiber( size_t idx, bool silent, bool updateSelector )
{
if( idx == 0 )
{
......@@ -231,7 +231,11 @@ void WFiberHandler::removeFiber( size_t idx, bool silent )
m_hidden->erase( m_hidden->begin() + idx );
m_possibleFiberSelections->remove( m_possibleFiberSelections->at( idx ) );
m_fiberSelection->set( m_possibleFiberSelections->getSelectorLast() );
if( updateSelector )
{
selectorUpdate( m_fibers->size() - 1 );
}
m_pointConnector->updateOutput();
......
......@@ -132,8 +132,9 @@ public:
* Removes a fiber at an index in the fibers vector.
* \param idx The index of the fiber.
* \param silent Whether or not this should add to the undo stack.
* \param updateSelector Whether the UI selector should be updated
*/
void removeFiber( size_t idx, bool silent = false );
void removeFiber( size_t idx, bool silent = false, bool updateSelector = true );
/**
* Toggles the visibility of a fiber.
......
......@@ -189,10 +189,6 @@ void WMPointConnector::handleInput()
if( pointsAndEventIDs )
{
int eventID = pointsAndEventIDs->getEventID( pointIdx );
if( eventID < 0 )
{
continue;
}
while( fibers->size() <= eventID )
{
......@@ -203,6 +199,14 @@ void WMPointConnector::handleInput()
}
}
for( size_t idx = fibers->size() - 1; idx > 0; idx--)
{
if( fibers->at( idx ).size() <= 1 )
{
m_fiberHandler->removeFiber( idx, true, false );
}
}
m_fiberHandler->setFiberCount( fibers->size() );
m_fiberHandler->selectorUpdate( fibers->size() - 1 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment