From de579af3525655188695451c96ca11ed565cad3a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 12 Apr 2023 11:15:17 +0200 Subject: [PATCH] SCH_LABEL_BASE::SetPosition(): ensure field positions are also handled. Fixes #14520 https://gitlab.com/kicad/code/kicad/issues/14520 --- eeschema/sch_label.cpp | 15 +++++++++++++++ eeschema/sch_label.h | 11 +++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index c9b0aecfc8..59ae1f1c78 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -290,6 +290,21 @@ VECTOR2I SCH_LABEL_BASE::GetSchematicTextOffset( const RENDER_SETTINGS* aSetting return text_offset; } +void SCH_LABEL_BASE::SetPosition( const VECTOR2I& aPosition ) +{ + VECTOR2I offset = aPosition - GetTextPos(); + Move( offset ); +} + + +void SCH_LABEL_BASE::Move( const VECTOR2I& aMoveVector ) +{ + SCH_TEXT::Move( aMoveVector ); + + for( SCH_FIELD& field : m_fields ) + field.Offset( aMoveVector ); +} + void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter ) { diff --git a/eeschema/sch_label.h b/eeschema/sch_label.h index 37da117ec6..3950d50ef0 100644 --- a/eeschema/sch_label.h +++ b/eeschema/sch_label.h @@ -112,17 +112,12 @@ public: */ bool IncrementLabel( int aIncrement ); - void Move( const VECTOR2I& aMoveVector ) override - { - SCH_TEXT::Move( aMoveVector ); - - for( SCH_FIELD& field : m_fields ) - field.Offset( aMoveVector ); - } - + void Move( const VECTOR2I& aMoveVector ) override; void Rotate( const VECTOR2I& aCenter ) override; void Rotate90( bool aClockwise ) override; + void SetPosition( const VECTOR2I& aPosition ) override; + void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; /**