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

@ -309,10 +309,13 @@ void SHAPE_LINE_CHAIN::Replace( int aStartIndex, int aEndIndex, const SHAPE_LINE
// The total new arcs index is added to the new arc indices // The total new arcs index is added to the new arc indices
size_t prev_arc_count = m_arcs.size(); size_t prev_arc_count = m_arcs.size();
auto new_shapes = aLine.m_shapes; std::vector<long> new_shapes = aLine.m_shapes;
for( auto& shape : new_shapes ) for( long& shape : new_shapes )
{
if( shape >= 0 )
shape += prev_arc_count; shape += prev_arc_count;
}
m_shapes.insert( m_shapes.begin() + aStartIndex, new_shapes.begin(), new_shapes.end() ); 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() ); 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 ) if( ok )
{ {
//Dbg()->AddLine( origLine.CLine(), 4, 100000 ); Dbg()->AddLine( origLine.CLine(), 5, 50000 );
Dbg()->AddLine( draggedWalk.CLine(), 6, 75000 );
m_lastNode->Remove( origLine ); m_lastNode->Remove( origLine );
optimizeAndUpdateDraggedLine( draggedWalk, origLine, aP ); optimizeAndUpdateDraggedLine( draggedWalk, origLine, aP );
} }
@ -550,7 +551,7 @@ bool DRAGGER::dragShove( const VECTOR2I& aP )
else else
dragged.DragCorner( aP, m_draggedSegmentIndex ); 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 ); SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );

View File

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