Allow rotate/mirror even when dragging
Keeps the lines connected but doesn't solve the crossed-wire mixups.
This allows common usage (mirroring labels/rotating segments) and leaves
prevention of the crossed wires to the user.
We can't really prevent crossed wires when rotating e.g. a part with
wires connected to 4 sides and users will not expect that. But we
should not disable useful features like mirroring multiple parallel
items to avoid a known impossible situation
Also provides an alternative solution to 345f506f0c
that allows us to
rotate groups without destroying connections on hover
Fixes https://gitlab.com/kicad/code/kicad/issues/8403
Fixes https://gitlab.com/kicad/code/kicad/issues/8523
This commit is contained in:
parent
4b38bd1543
commit
71602475eb
|
@ -380,22 +380,31 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset )
|
|||
|
||||
void SCH_LINE::MirrorVertically( int aCenter )
|
||||
{
|
||||
MIRROR( m_start.y, aCenter );
|
||||
MIRROR( m_end.y, aCenter );
|
||||
if( m_flags & STARTPOINT )
|
||||
MIRROR( m_start.y, aCenter );
|
||||
|
||||
if( m_flags & ENDPOINT )
|
||||
MIRROR( m_end.y, aCenter );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
MIRROR( m_start.x, aCenter );
|
||||
MIRROR( m_end.x, aCenter );
|
||||
if( m_flags & STARTPOINT )
|
||||
MIRROR( m_start.x, aCenter );
|
||||
|
||||
if( m_flags & ENDPOINT )
|
||||
MIRROR( m_end.x, aCenter );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
RotatePoint( &m_start, aCenter, 900 );
|
||||
RotatePoint( &m_end, aCenter, 900 );
|
||||
if( m_flags & STARTPOINT )
|
||||
RotatePoint( &m_start, aCenter, 900 );
|
||||
|
||||
if( m_flags & ENDPOINT )
|
||||
RotatePoint( &m_end, aCenter, 900 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// Collect items at the clicked location (doesn't select them yet)
|
||||
if( CollectHits( collector, evt->Position()) )
|
||||
{
|
||||
narrowSelection( collector, evt->Position(), false );
|
||||
narrowSelection( collector, evt->Position(), false, false );
|
||||
|
||||
if( collector.GetCount() == 1 && !m_isSymbolEditor && !modifier_enabled )
|
||||
{
|
||||
|
@ -613,7 +613,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// for "auto starting" wires when clicked
|
||||
if( CollectHits( collector, evt->Position() ) )
|
||||
{
|
||||
narrowSelection( collector, evt->Position(), false );
|
||||
narrowSelection( collector, evt->Position(), false, false );
|
||||
|
||||
if( collector.GetCount() == 1 && !modifier_enabled )
|
||||
{
|
||||
|
@ -807,7 +807,7 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a
|
|||
|
||||
|
||||
void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere,
|
||||
bool aCheckLocked )
|
||||
bool aCheckLocked, bool aSelectPoints )
|
||||
{
|
||||
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
||||
{
|
||||
|
@ -824,7 +824,7 @@ void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I
|
|||
}
|
||||
|
||||
// SelectPoint, unlike other selection routines, can select line ends
|
||||
if( collector[i]->Type() == SCH_LINE_T )
|
||||
if( aSelectPoints && collector[i]->Type() == SCH_LINE_T )
|
||||
{
|
||||
SCH_LINE* line = (SCH_LINE*) collector[i];
|
||||
line->ClearFlags( STARTPOINT | ENDPOINT );
|
||||
|
@ -925,7 +925,7 @@ bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFil
|
|||
if( !CollectHits( collector, aWhere, aFilterList ) )
|
||||
return false;
|
||||
|
||||
narrowSelection( collector, aWhere, aCheckLocked );
|
||||
narrowSelection( collector, aWhere, aCheckLocked, true );
|
||||
|
||||
return selectPoint( collector, aItem, aSelectionCancelledFlag, aAdd, aSubtract, aExclusiveOr );
|
||||
}
|
||||
|
|
|
@ -189,8 +189,13 @@ private:
|
|||
/**
|
||||
* Apply rules to narrow the collection down to selectable objects, and then heuristics
|
||||
* to try and narrow it to a single object.
|
||||
*
|
||||
* @param collector EE_COLLECTOR with elements to filter
|
||||
* @param aWhere point where we should narrow (if relevant)
|
||||
* @param aCheckLocked If false, remove locked elements from #collector
|
||||
* @param aSelectPoints If true, set STARTPOINT/ENDPOINT flags on individual wires
|
||||
*/
|
||||
void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked );
|
||||
void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked, bool aSelectPoints );
|
||||
|
||||
/**
|
||||
* This is the primary SelectPoint method that will prompt the user with a menu to disambiguate
|
||||
|
|
|
@ -579,10 +579,10 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
// If we are rotating more than one item, we do not have start/end
|
||||
// points separately selected
|
||||
if( item->HasFlag( STARTPOINT ) || principalItemCount > 1 )
|
||||
if( item->HasFlag( STARTPOINT ) )
|
||||
line->RotateStart( rotPoint );
|
||||
|
||||
if( item->HasFlag( ENDPOINT ) || principalItemCount > 1 )
|
||||
if( item->HasFlag( ENDPOINT ) )
|
||||
line->RotateEnd( rotPoint );
|
||||
}
|
||||
else if( item->Type() == SCH_SHEET_PIN_T )
|
||||
|
|
|
@ -421,16 +421,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|| evt->IsAction( &EE_ACTIONS::mirrorH )
|
||||
|| evt->IsAction( &EE_ACTIONS::mirrorV ) )
|
||||
{
|
||||
if( m_isDrag )
|
||||
{
|
||||
// These are just going to make a mess, so eat them without doing anything.
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allow operations while moving
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue