diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 3dec6a0e83..ef84587800 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -1476,12 +1476,10 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); - int lineWidth = Mils2iu( cfg->m_Drawing.default_line_thickness ); - if( isTextBox ) - item = new SCH_TEXTBOX( lineWidth, m_lastFillStyle ); + item = new SCH_TEXTBOX( 0, m_lastFillStyle ); else - item = new SCH_SHAPE( type, lineWidth, m_lastFillStyle ); + item = new SCH_SHAPE( type, 0, m_lastFillStyle ); item->SetFlags( IS_NEW ); item->BeginEdit( (wxPoint) cursorPos ); @@ -1489,10 +1487,12 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) m_view->ClearPreview(); m_view->AddToPreview( item->Clone() ); } - else if( item && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) + else if( item && ( evt->IsClick( BUT_LEFT ) + || evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &EE_ACTIONS::finishDrawing ) ) ) { - if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &EE_ACTIONS::finishDrawing ) + if( evt->IsDblClick( BUT_LEFT ) + || evt->IsAction( &EE_ACTIONS::finishDrawing ) || !item->ContinueEdit( (wxPoint) cursorPos ) ) { item->EndEdit(); diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 97bef5aefd..2a48abc26d 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -636,8 +636,8 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, grid.ClearMaskFlag( GRID_HELPER::HORIZONTAL ); } - VECTOR2I eventPosition = static_cast( - evt->HasPosition() ? evt->Position() : controls->GetMousePosition() ); + VECTOR2D eventPosition = evt->HasPosition() ? evt->Position() + : controls->GetMousePosition(); VECTOR2I cursorPos = grid.BestSnapAnchor( eventPosition, LAYER_CONNECTABLE, segment ); controls->ForceCursorPosition( true, cursorPos ); @@ -858,10 +858,14 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, { // Coerce the line to vertical/horizontal/45 as necessary if( twoSegments && m_wires.size() >= 2 ) + { computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode ); + } else + { segment->SetEndPoint( cursorPos ); + } } for( SCH_LINE* wire : m_wires ) @@ -886,10 +890,14 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, // Find new bend point for current mode if( twoSegments && m_wires.size() >= 2 ) + { computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode ); + } else + { segment->SetEndPoint( cursorPos ); + } for( SCH_LINE* wire : m_wires ) { @@ -1002,9 +1010,9 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos { switch( aType ) { - default: aSegment = new SCH_LINE( aPos, LAYER_NOTES ); break; - case LAYER_WIRE: aSegment = new SCH_LINE( aPos, LAYER_WIRE ); break; - case LAYER_BUS: aSegment = new SCH_LINE( aPos, LAYER_BUS ); break; + default: aSegment = new SCH_LINE( aPos, LAYER_NOTES ); break; + case LAYER_WIRE: aSegment = new SCH_LINE( aPos, LAYER_WIRE ); break; + case LAYER_BUS: aSegment = new SCH_LINE( aPos, LAYER_BUS ); break; } // Give segments a parent so they find the default line/wire/bus widths