Disallow dropping curves onto other curves

* Dropping curves between other curves works much better with this change.
This commit is contained in:
Gaute Lindkvist
2020-08-13 12:00:53 +02:00
parent fee1608cda
commit 6bcf1b56fe
6 changed files with 85 additions and 239 deletions

View File

@@ -229,7 +229,7 @@ void RimMultiPlot::removePlot( RimPlot* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, int insertAtPosition )
{
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
@@ -245,12 +245,16 @@ void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, Ri
}
}
size_t insertionStartIndex = 0;
if ( plotToInsertAfter ) insertionStartIndex = this->plotIndex( plotToInsertAfter ) + 1;
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
this->insertPlot( plotsToMove[tIdx], insertionStartIndex + tIdx );
if ( insertAtPosition >= 0 )
{
this->insertPlot( plotsToMove[tIdx], (size_t)insertAtPosition + tIdx );
}
else
{
this->addPlot( plotsToMove[tIdx] );
}
}
this->updateLayout();

View File

@@ -72,7 +72,7 @@ public:
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
void movePlotsToThis( const std::vector<RimPlot*>& plots, RimPlot* plotToInsertAfter );
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
size_t plotCount() const;
size_t plotIndex( const RimPlot* plot ) const;