From 980dec08cf6e229bed31aa3e20f7cd5ae1b3b676 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 7 Jan 2014 14:09:27 +0100 Subject: [PATCH] Fixed bounding box for module texts. --- pcbnew/class_text_mod.cpp | 12 ++++++++++++ pcbnew/class_text_mod.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index fbebde39bd..71deb4a462 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -415,6 +415,18 @@ EDA_ITEM* TEXTE_MODULE::Clone() const } +const BOX2I TEXTE_MODULE::ViewBBox() const +{ + double angle = GetDrawRotation(); + EDA_RECT text_area = GetTextBox( -1, -1 ); + + if( angle ) + text_area = text_area.GetBoundingBoxRotated( m_Pos, angle ); + + return BOX2I( text_area.GetPosition(), text_area.GetSize() ); +} + + void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const { switch( m_Type ) diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 3452d4f316..97e15ab202 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -165,6 +165,9 @@ public: EDA_ITEM* Clone() const; + /// @copydoc VIEW_ITEM::ViewBBox() + virtual const BOX2I ViewBBox() const; + /// @copydoc VIEW_ITEM::ViewGetLayers() virtual void ViewGetLayers( int aLayers[], int& aCount ) const;