Schematic: breaking wire needs different drag parameters
Our heuristics for determining when to append to the undo aren't sufficient for the two segments of a broken wire. One is new and the other is changed, but the drag should be appended to the current undo. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10865
This commit is contained in:
parent
4c86a5ce64
commit
2535237c31
|
@ -1700,7 +1700,9 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
|
|||
m_frame->OnModify();
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::drag );
|
||||
SCH_MOVE_TOOL_PARAMS params = { .appendToLastUndo = true, .placingNewItems = false };
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::drag, true, ¶ms );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -88,6 +88,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
EE_GRID_HELPER grid( m_toolMgr );
|
||||
bool wasDragging = m_moveInProgress && m_isDrag;
|
||||
SCH_MOVE_TOOL_PARAMS* params = aEvent.Parameter<SCH_MOVE_TOOL_PARAMS*>();
|
||||
|
||||
m_anchorPos.reset();
|
||||
|
||||
|
@ -174,8 +175,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( !m_moveInProgress ) // Prepare to start moving/dragging
|
||||
{
|
||||
SCH_ITEM* sch_item = (SCH_ITEM*) selection.Front();
|
||||
bool appendUndo = sch_item && sch_item->IsNew();
|
||||
bool placingNewItems = sch_item && sch_item->IsNew();
|
||||
bool appendUndo =
|
||||
params ? params->appendToLastUndo : ( sch_item && sch_item->IsNew() );
|
||||
bool placingNewItems =
|
||||
params ? params->placingNewItems : ( sch_item && sch_item->IsNew() );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Setup a drag or a move
|
||||
|
|
|
@ -40,6 +40,13 @@ struct SPECIAL_CASE_LABEL_INFO
|
|||
};
|
||||
|
||||
|
||||
struct SCH_MOVE_TOOL_PARAMS
|
||||
{
|
||||
bool appendToLastUndo;
|
||||
bool placingNewItems;
|
||||
};
|
||||
|
||||
|
||||
class SCH_MOVE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue