Fix bus unfolding in the wake of bus entry changes
Since bus entry shape is not a thing anymore, unfolding routine can be simplified to just use size Fixes https://gitlab.com/kicad/code/kicad/-/issues/4853
This commit is contained in:
parent
66bdd37637
commit
4a5792cb87
|
@ -374,7 +374,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos, '\\' );
|
||||
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
|
||||
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
|
||||
m_frame->AddToScreen( m_busUnfold.entry );
|
||||
|
||||
|
@ -634,23 +634,25 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
wxPoint cursor_delta = cursorPos - m_busUnfold.origin;
|
||||
SCH_BUS_WIRE_ENTRY* entry = m_busUnfold.entry;
|
||||
|
||||
bool offset = ( cursor_delta.x < 0 );
|
||||
bool flipX = ( cursor_delta.x < 0 );
|
||||
bool flipY = ( cursor_delta.y < 0 );
|
||||
|
||||
// Erase and redraw if necessary
|
||||
if( offset != m_busUnfold.offset )
|
||||
if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY )
|
||||
{
|
||||
wxPoint entry_pos = m_busUnfold.origin;
|
||||
wxSize size = entry->GetSize();
|
||||
int ySign = flipY ? -1 : 1;
|
||||
int xSign = flipX ? -1 : 1;
|
||||
|
||||
if( offset )
|
||||
entry_pos -= entry->GetSize();
|
||||
size.x = std::abs( size.x ) * xSign;
|
||||
size.y = std::abs( size.y ) * ySign;
|
||||
entry->SetSize( size );
|
||||
|
||||
entry->SetPosition( entry_pos );
|
||||
m_busUnfold.offset = offset;
|
||||
m_busUnfold.flipY = flipY;
|
||||
m_busUnfold.flipX = flipX;
|
||||
|
||||
m_frame->RefreshItem( entry );
|
||||
|
||||
wxPoint wire_start = offset ? entry->GetPosition() : entry->m_End();
|
||||
m_wires.front()->SetStartPoint( wire_start );
|
||||
m_wires.front()->SetStartPoint( entry->m_End() );
|
||||
}
|
||||
|
||||
// Update the label "ghost" position
|
||||
|
|
|
@ -48,7 +48,8 @@ class EE_SELECTION_TOOL;
|
|||
struct BUS_UNFOLDING_T
|
||||
{
|
||||
bool in_progress; ///< True if bus unfold operation is running
|
||||
bool offset; ///< True if the bus entry should be offset from origin
|
||||
bool flipX; ///< True if the bus entry should be flipped in the x-axis
|
||||
bool flipY; ///< True if the bus entry should be flipped in the y-axis
|
||||
bool label_placed; ///< True if user has placed the net label
|
||||
|
||||
wxPoint origin; ///< Origin (on the bus) of the unfold
|
||||
|
|
Loading…
Reference in New Issue