← Back to team overview

kicad-developers team mailing list archive

Re: LIB_TEXT bounding boxes

 

Yeah, I know that much - I'm just trying to figure out where the 
LIB_TEXT bounding boxes are going /wrong/. Try it - turn on the switch 
to view the bounding boxes (sch_component.cpp line 382, recommend 
changing GetBoundingBox on 385 to GetBodyBoundingBox, it's a bit more 
helpful in this case) and move around some LIB_TEXT instances in a 
component. The vertical axis is inverted, so that when you move the text 
downwards, the bounding box grows upwards.

On Wed, Jun 17, 2015 at 05:35:43PM +0200, jp charras wrote:
> Le 17/06/2015 00:11, Chris Pavlina a écrit :
> > Hi all,
> > 
> > While working on that field autoplace feature, I noticed that 
> > LIB_PART::GetBodyBoundingBox was returning incorrect bounding boxes when 
> > the parts contained a LIB_TEXT. Further investigation revealed that 
> > there was an extra negation of the vertical dimension somewhere in the 
> > mix. The trouble is, there appear to be multiple of these, because 
> > adding or removing negations would fix it in this place, but would cause 
> > other troubles (text rendering in the wrong spot in libedit, or clicks 
> > not being received). The only way I found that worked was to 
> > special-case LIB_TEXT inside LIB_PART::GetBodyBoundingBox, negating both 
> > the Y position and Y size. Ugly hack attached.
> > 
> > Anyone familiar enough to have a guess as to what the "real" problem is, 
> > without me spending hours digging into the entirety of the bounding box 
> > code? The ugly hack works, but... ew.
> > 
> > --
> > Chris
> 
> For historical reasons, the Y axis is bottom to top for coordinates of
> symbols (graphic items, texts ..) in libraries, and is top to bottom in
> schematic.
> 
> When drawing a symbol, a matrix transform is applied to coordinates, to
> take in account the Y axis orientation, as well as component orientation
> (rotation, mirroring).
> 
> 
> -- 
> Jean-Pierre CHARRAS
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References