From 760bc709211ade3dc80fe9af9067bfaa049aee2e Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 5 Oct 2017 20:15:10 +0300 Subject: [PATCH] Crash by zoom in the viewer in a neutral point: arrows recompute should be performed only if skech operation is active. --- src/PartSet/PartSet_Module.cpp | 49 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 4cdd4e928..8ae275c83 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -986,29 +986,36 @@ void PartSet_Module::onViewTransformed(int theTrsfType) } if (aView.IsNull()) return; - double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize()); - - double aPrevLen = SketcherPrs_Tools::getArrowSize(); - SketcherPrs_Tools::setArrowSize(aLen); - const double aCurScale = aViewer->activeView()->Camera()->Scale(); - aViewer->SetScale(aViewer->activeView(), aCurScale); - double aTextHeight = SketcherPrs_Tools::getConfigTextHeight(); - SketcherPrs_Tools::setTextHeight (aTextHeight); - bool isModified = false; - QList aPrsList = aDisplayer->displayedPresentations(); - foreach (AISObjectPtr aAIS, aPrsList) { - Handle(AIS_InteractiveObject) aAisObj = aAIS->impl(); - - Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj); - if (!aDim.IsNull()) { - aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen); - aDim->DimensionAspect()->TextAspect()->SetHeight(aTextHeight); - aContext->Redisplay(aDim, false); - isModified = true; + + ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation(); + if (aCurrentOperation && + (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) || + sketchMgr()->isNestedSketchOperation(aCurrentOperation))) + { + double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize()); + + double aPrevLen = SketcherPrs_Tools::getArrowSize(); + SketcherPrs_Tools::setArrowSize(aLen); + const double aCurScale = aViewer->activeView()->Camera()->Scale(); + aViewer->SetScale(aViewer->activeView(), aCurScale); + double aTextHeight = SketcherPrs_Tools::getConfigTextHeight(); + SketcherPrs_Tools::setTextHeight (aTextHeight); + bool isModified = false; + QList aPrsList = aDisplayer->displayedPresentations(); + foreach (AISObjectPtr aAIS, aPrsList) { + Handle(AIS_InteractiveObject) aAisObj = aAIS->impl(); + + Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj); + if (!aDim.IsNull()) { + aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen); + aDim->DimensionAspect()->TextAspect()->SetHeight(aTextHeight); + aContext->Redisplay(aDim, false); + isModified = true; + } } + if (isModified) + aDisplayer->updateViewer(); } - if (isModified) - aDisplayer->updateViewer(); } bool PartSet_Module::isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const -- 2.39.2