Bug fixes and enhancements for dimensions.
1) Make them easier to select. 2) Mirror text when flipping to other side of board. 3) Flip around a more "known" point (the text position isn't really here nor there). Fixes https://gitlab.com/kicad/code/kicad/issues/6219
This commit is contained in:
parent
5507575d64
commit
5ede4061e3
|
@ -65,18 +65,6 @@ void DIMENSION::SetParent( EDA_ITEM* aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIMENSION::SetPosition( const wxPoint& aPos )
|
|
||||||
{
|
|
||||||
m_text.SetTextPos( aPos );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxPoint DIMENSION::GetPosition() const
|
|
||||||
{
|
|
||||||
return m_text.GetTextPos();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIMENSION::updateText()
|
void DIMENSION::updateText()
|
||||||
{
|
{
|
||||||
wxString text = m_overrideTextEnabled ? m_valueString : GetValueText();
|
wxString text = m_overrideTextEnabled ? m_valueString : GetValueText();
|
||||||
|
@ -271,7 +259,6 @@ void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
|
||||||
wxPoint newPos = m_text.GetTextPos();
|
wxPoint newPos = m_text.GetTextPos();
|
||||||
|
|
||||||
#define INVERT( pos ) ( ( pos ) = axis - ( ( pos ) - axis ) )
|
#define INVERT( pos ) ( ( pos ) = axis - ( ( pos ) - axis ) )
|
||||||
|
|
||||||
if( aMirrorLeftRight )
|
if( aMirrorLeftRight )
|
||||||
INVERT( newPos.x );
|
INVERT( newPos.x );
|
||||||
else
|
else
|
||||||
|
@ -293,6 +280,8 @@ void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
|
||||||
INVERT( m_end.y );
|
INVERT( m_end.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_text.SetMirrored( !m_text.IsMirrored() );
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,9 +129,8 @@ public:
|
||||||
virtual const wxPoint& GetEnd() const { return m_end; }
|
virtual const wxPoint& GetEnd() const { return m_end; }
|
||||||
virtual void SetEnd( const wxPoint& aPoint );
|
virtual void SetEnd( const wxPoint& aPoint );
|
||||||
|
|
||||||
// These deal with the text position
|
wxPoint GetPosition() const override { return m_start; }
|
||||||
wxPoint GetPosition() const override;
|
void SetPosition( const wxPoint& aPos ) override { m_start = aPos; }
|
||||||
void SetPosition( const wxPoint& aPos ) override;
|
|
||||||
|
|
||||||
bool GetOverrideTextEnabled() const { return m_overrideTextEnabled; }
|
bool GetOverrideTextEnabled() const { return m_overrideTextEnabled; }
|
||||||
void SetOverrideTextEnabled( bool aOverride ) { m_overrideTextEnabled = aOverride; }
|
void SetOverrideTextEnabled( bool aOverride ) { m_overrideTextEnabled = aOverride; }
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
#include <class_pad.h>
|
#include <class_pad.h>
|
||||||
#include <class_track.h>
|
#include <class_track.h>
|
||||||
#include <class_marker_pcb.h>
|
#include <class_marker_pcb.h>
|
||||||
|
#include <class_dimension.h>
|
||||||
#include <class_zone.h>
|
#include <class_zone.h>
|
||||||
#include <pcb_shape.h>
|
#include <pcb_shape.h>
|
||||||
#include <class_pcb_group.h>
|
#include <class_pcb_group.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
|
|
||||||
|
|
||||||
/* This module contains out of line member functions for classes given in
|
/* This module contains out of line member functions for classes given in
|
||||||
* collectors.h. Those classes augment the functionality of class PCB_EDIT_FRAME.
|
* collectors.h. Those classes augment the functionality of class PCB_EDIT_FRAME.
|
||||||
*/
|
*/
|
||||||
|
@ -196,6 +196,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||||
MARKER_PCB* marker = nullptr;
|
MARKER_PCB* marker = nullptr;
|
||||||
ZONE_CONTAINER* zone = nullptr;
|
ZONE_CONTAINER* zone = nullptr;
|
||||||
PCB_SHAPE* shape = nullptr;
|
PCB_SHAPE* shape = nullptr;
|
||||||
|
DIMENSION* dimension = nullptr;
|
||||||
|
|
||||||
#if 0 // debugging
|
#if 0 // debugging
|
||||||
static int breakhere = 0;
|
static int breakhere = 0;
|
||||||
|
@ -324,6 +325,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||||
case PCB_DIM_CENTER_T:
|
case PCB_DIM_CENTER_T:
|
||||||
case PCB_DIM_ORTHOGONAL_T:
|
case PCB_DIM_ORTHOGONAL_T:
|
||||||
case PCB_DIM_LEADER_T:
|
case PCB_DIM_LEADER_T:
|
||||||
|
dimension = static_cast<DIMENSION*>( item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
|
@ -493,7 +495,17 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||||
{
|
{
|
||||||
if( shape->HitTest( m_refPos, accuracy ) )
|
if( shape->HitTest( m_refPos, accuracy ) )
|
||||||
{
|
{
|
||||||
Append( item );
|
Append( shape );
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( dimension )
|
||||||
|
{
|
||||||
|
// Dimensions feels particularly hard to select, probably due to their
|
||||||
|
// noisy shape making it feel like they should have a larger bounary.
|
||||||
|
if( dimension->HitTest( m_refPos, KiROUND( accuracy * 1.5 ) ) )
|
||||||
|
{
|
||||||
|
Append( dimension );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,7 +569,17 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||||
{
|
{
|
||||||
if( shape->HitTest( m_refPos, accuracy ) )
|
if( shape->HitTest( m_refPos, accuracy ) )
|
||||||
{
|
{
|
||||||
Append( item );
|
Append( shape );
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( dimension )
|
||||||
|
{
|
||||||
|
// Dimensions feels particularly hard to select, probably due to their
|
||||||
|
// noisy shape making it feel like they should have a larger bounary.
|
||||||
|
if( dimension->HitTest( m_refPos, KiROUND( accuracy * 1.5 ) ) )
|
||||||
|
{
|
||||||
|
Append( dimension );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
||||||
// of the bounding box center) to avoid moving the item anchor
|
// of the bounding box center) to avoid moving the item anchor
|
||||||
if( selection.GetSize() == 1 )
|
if( selection.GetSize() == 1 )
|
||||||
{
|
{
|
||||||
if( selection.HasReferencePoint() )
|
if( m_dragging && selection.HasReferencePoint() )
|
||||||
modPoint = selection.GetReferencePoint();
|
modPoint = selection.GetReferencePoint();
|
||||||
else
|
else
|
||||||
modPoint = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition();
|
modPoint = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition();
|
||||||
|
|
Loading…
Reference in New Issue