]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: Provide sane default bounding box (For Image & Text)
authorThomas Geymayer <tomgey@gmail.com>
Wed, 9 Jan 2013 11:11:19 +0000 (12:11 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Wed, 9 Jan 2013 11:11:19 +0000 (12:11 +0100)
simgear/canvas/elements/CanvasElement.cxx

index b0f84d558f1a4453c22672f69b6555b8717fa98e..e11e563b0357c764704677bd4ce864970d483cda 100644 (file)
@@ -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;
   }
 
   //----------------------------------------------------------------------------