Minor fixes and enhancements
This commit is contained in:
parent
93a0e9e3d2
commit
8ba11dbd68
|
@ -110,6 +110,12 @@ public:
|
|||
wxPoint GetCenter() { return m_Start; } /// returns the center of a circle or arc
|
||||
wxPoint GetArcStart() { return m_End; } /// returns the start point of an arc
|
||||
|
||||
// Geometric transform
|
||||
/** Move the primitive
|
||||
* @param aMoveVector is the deplacement vector
|
||||
*/
|
||||
void Move( wxPoint aMoveVector );
|
||||
|
||||
/** Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT
|
||||
* useful to draw a primitive shape
|
||||
* @param aTarget is the DRAWSEGMENT to initialize
|
||||
|
|
|
@ -71,6 +71,18 @@ void PAD_CS_PRIMITIVE::ExportTo( EDGE_MODULE* aTarget )
|
|||
}
|
||||
|
||||
|
||||
void PAD_CS_PRIMITIVE::Move( wxPoint aMoveVector )
|
||||
{
|
||||
m_Start += aMoveVector;
|
||||
m_End += aMoveVector;
|
||||
|
||||
for( auto& corner : m_Poly )
|
||||
{
|
||||
corner += aMoveVector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Has meaning only for free shape pads.
|
||||
* add a free shape to the shape list.
|
||||
|
@ -369,7 +381,8 @@ bool D_PAD::GetBestAnchorPosition( VECTOR2I& aPos )
|
|||
minDistEdge = std::max( GetSize().x, GetSize().y );
|
||||
}
|
||||
|
||||
auto bestAnchor( []()->boost::optional<VECTOR2I>{ return boost::none; }() );
|
||||
boost::optional<VECTOR2I> bestAnchor( []()->
|
||||
boost::optional<VECTOR2I>{ return boost::none; }() );
|
||||
|
||||
for ( int y = 0; y < stepsY ; y++ )
|
||||
{
|
||||
|
|
|
@ -494,16 +494,7 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
// relocate the shapes, they are relative to the anchor pad position
|
||||
for( auto& shape : shapes )
|
||||
{
|
||||
shape.m_Start.x -= anchor->x;
|
||||
shape.m_Start.y -= anchor->y;
|
||||
shape.m_End.x -= anchor->x;
|
||||
shape.m_End.y -= anchor->y;
|
||||
|
||||
for( auto&p : shape.m_Poly )
|
||||
{
|
||||
p.x -= anchor->x;
|
||||
p.y -= anchor->y;
|
||||
}
|
||||
shape.Move( wxPoint( -anchor->x, -anchor->y ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -514,7 +505,9 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( !result )
|
||||
{
|
||||
DisplayErrorMessage( frame(), _("Cannot convert items to a custom-shaped pad: selected items do not form a single solid shape.") );
|
||||
DisplayErrorMessage( frame(),
|
||||
_( "Cannot convert items to a custom-shaped pad:\n"
|
||||
"selected items do not form a single solid shape.") );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -529,7 +522,7 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
|
||||
|
||||
commit.Push(_("Create Pad From Selected Shapes") );
|
||||
commit.Push(_("Create Pad from Selected Shapes") );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue