Salome HOME
Optimization of Viewer performance up to two times
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.cpp
index 0494aeec96a58da2715bab9d36ab4e87c6a32d52..636abd69f2a5638603e1932edcad61801aa6da24 100644 (file)
@@ -301,7 +301,8 @@ void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double th
       aView3d->SetTwist( theTwist );
       aView3d->FitAll(0.01, true);
       aView3d->SetZSize(0.);
-      aView3d->DepthFitAll();
+      if (aView3d->Depth() < 0.1)
+        aView3d->DepthFitAll();
     }
   }
 }
@@ -395,7 +396,9 @@ void NewGeom_SalomeViewer::Zfitall()
   OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
   if (aView) {
     OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
-    aWnd->getViewPort()->getView()->ZFitAll();
-    aWnd->getViewPort()->getView()->DepthFitAll();
+    Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
+    aView3d->ZFitAll();
+    if (aView3d->Depth() < 0.1)
+      aView3d->DepthFitAll();
   }
 }
\ No newline at end of file