# HG changeset patch # User Alain Mazy # Date 1587399647 -7200 # Node ID 1e4878ed1d77b3b19ad8103f808796de98b05951 # Parent e0cdf8688d56da396e5748b691acfbf73c15f3a8 added GetBoundingBox to Scene2D diff -r e0cdf8688d56 -r 1e4878ed1d77 Framework/Scene2D/Scene2D.cpp --- a/Framework/Scene2D/Scene2D.cpp Wed Apr 08 14:14:51 2020 +0200 +++ b/Framework/Scene2D/Scene2D.cpp Mon Apr 20 18:20:47 2020 +0200 @@ -222,22 +222,29 @@ canvasToScene_ = inverse; } + void Scene2D::GetBoundingBox(Extent2D &target) const + { + target.Reset(); + + for (Content::const_iterator it = content_.begin(); + it != content_.end(); ++it) + { + assert(it->second != NULL); + + Extent2D tmp; + if (it->second->GetLayer().GetBoundingBox(tmp)) + { + target.Union(tmp); + } + } + } + void Scene2D::FitContent(unsigned int canvasWidth, unsigned int canvasHeight) { Extent2D extent; - for (Content::const_iterator it = content_.begin(); - it != content_.end(); ++it) - { - assert(it->second != NULL); - - Extent2D tmp; - if (it->second->GetLayer().GetBoundingBox(tmp)) - { - extent.Union(tmp); - } - } + GetBoundingBox(extent); if (!extent.IsEmpty()) { diff -r e0cdf8688d56 -r 1e4878ed1d77 Framework/Scene2D/Scene2D.h --- a/Framework/Scene2D/Scene2D.h Wed Apr 08 14:14:51 2020 +0200 +++ b/Framework/Scene2D/Scene2D.h Mon Apr 20 18:20:47 2020 +0200 @@ -113,5 +113,7 @@ void FitContent(unsigned int canvasWidth, unsigned int canvasHeight); + + void GetBoundingBox(Extent2D& target) const; }; }