PNS: Fix dragging of segments with arcs in line

This commit is contained in:
Jon Evans 2021-04-11 10:18:57 -04:00
parent a30894e5a1
commit 7ba110bd77
3 changed files with 11 additions and 7 deletions

View File

@ -308,11 +308,14 @@ void SHAPE_LINE_CHAIN::Replace( int aStartIndex, int aEndIndex, const SHAPE_LINE
Remove( aStartIndex, aEndIndex );
// The total new arcs index is added to the new arc indices
size_t prev_arc_count = m_arcs.size();
auto new_shapes = aLine.m_shapes;
size_t prev_arc_count = m_arcs.size();
std::vector<long> new_shapes = aLine.m_shapes;
for( auto& shape : new_shapes )
shape += prev_arc_count;
for( long& shape : new_shapes )
{
if( shape >= 0 )
shape += prev_arc_count;
}
m_shapes.insert( m_shapes.begin() + aStartIndex, new_shapes.begin(), new_shapes.end() );
m_points.insert( m_points.begin() + aStartIndex, aLine.m_points.begin(), aLine.m_points.end() );

View File

@ -506,7 +506,8 @@ bool DRAGGER::dragWalkaround( const VECTOR2I& aP )
if( ok )
{
//Dbg()->AddLine( origLine.CLine(), 4, 100000 );
Dbg()->AddLine( origLine.CLine(), 5, 50000 );
Dbg()->AddLine( draggedWalk.CLine(), 6, 75000 );
m_lastNode->Remove( origLine );
optimizeAndUpdateDraggedLine( draggedWalk, origLine, aP );
}
@ -550,7 +551,7 @@ bool DRAGGER::dragShove( const VECTOR2I& aP )
else
dragged.DragCorner( aP, m_draggedSegmentIndex );
Dbg()->AddLine( dragged.CLine(), 5, 10000 );
Dbg()->AddLine( dragged.CLine(), 5, 5000 );
SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );

View File

@ -119,7 +119,7 @@ public:
bool IsLinkedChecked() const
{
return IsLinked() && LinkCount() == SegmentCount();
return IsLinked() && LinkCount() == ShapeCount();
}
///< Assign a shape to the line (a polyline/line chain).