diff Framework/Scene2DViewport/ViewportController.cpp @ 1053:32b403a47b19

simplifying IViewport
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Oct 2019 15:24:48 +0200
parents 348866dd217c
children e713f1a99861 2d8ab34c8c91
line wrap: on
line diff
--- a/Framework/Scene2DViewport/ViewportController.cpp	Thu Oct 10 14:37:23 2019 +0200
+++ b/Framework/Scene2DViewport/ViewportController.cpp	Thu Oct 10 15:24:48 2019 +0200
@@ -168,8 +168,12 @@
 
   void ViewportController::FitContent()
   {
-    viewport_.GetScene().FitContent(viewport_.GetCanvasWidth(), viewport_.GetCanvasHeight());
-    BroadcastMessage(SceneTransformChanged(*this));
+    if (viewport_.HasCompositor())
+    {
+      const ICompositor& compositor = viewport_.GetCompositor();
+      viewport_.GetScene().FitContent(compositor.GetCanvasWidth(), compositor.GetCanvasHeight());
+      BroadcastMessage(SceneTransformChanged(*this));
+    }
   }
 
   void ViewportController::AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool)
@@ -219,4 +223,3 @@
     return TEXT_CENTER_DISTANCE_CANVAS_COORD * GetCanvasToSceneFactor();
   }
 }
-