From: Thomas Geymayer Date: Wed, 9 Jan 2013 11:11:19 +0000 (+0100) Subject: Canvas: Provide sane default bounding box (For Image & Text) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ea8023e51f17d2213d4f61548a91eb403e322656;p=simgear.git Canvas: Provide sane default bounding box (For Image & Text) --- diff --git a/simgear/canvas/elements/CanvasElement.cxx b/simgear/canvas/elements/CanvasElement.cxx index b0f84d55..e11e563b 100644 --- a/simgear/canvas/elements/CanvasElement.cxx +++ b/simgear/canvas/elements/CanvasElement.cxx @@ -405,7 +405,15 @@ namespace canvas //---------------------------------------------------------------------------- osg::BoundingBox Element::getTransformedBounds(const osg::Matrix& m) const { - return osg::BoundingBox(); + if( !_drawable ) + return osg::BoundingBox(); + + osg::BoundingBox transformed; + const osg::BoundingBox& bb = _drawable->getBound(); + for(int i = 0; i < 4; ++i) + transformed.expandBy( m * bb.corner(i) ); + + return transformed; } //----------------------------------------------------------------------------