From 4942331141efc972607aa842260530d1a96b489a Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 19 Dec 2017 15:01:57 +0300 Subject: [PATCH] Issue #2293 Size of the view of a sketch is lost when pressing Set Plane View : restore zoom of the view to the entered value. --- src/PartSet/PartSet_PreviewSketchPlane.cpp | 1 + src/PartSet/PartSet_WidgetSketchLabel.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 243b23268..afd0e268c 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -124,6 +124,7 @@ AISObjectPtr PartSet_PreviewSketchPlane::createPreviewPlane() int aDispMode = 1; // shading Handle(AIS_InteractiveObject) anAISIO = aAIS->impl(); if (!anAISIO.IsNull()) { + //anAISIO->SetInfiniteState(Standard_True); anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True ); anAISIO->SetDisplayMode(aDispMode); } diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 7f383d6ef..96a84446d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -354,6 +354,20 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs if (aRotate) { myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist); } + QString aSizeOfViewStr = mySizeOfView->text(); + if (!aSizeOfViewStr.isEmpty()) { + bool isOk; + double aSizeOfView = aSizeOfViewStr.toDouble(&isOk); + if (isOk && aSizeOfView > 0) { + Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView(); + if (!aView3d.IsNull()) { + Bnd_Box aBndBox; + double aHalfSize = aSizeOfView/2.0; + aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize); + aView3d->FitAll(aBndBox, 0.01, false); + } + } + } PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); if (aModule) aModule->onViewTransformed(); -- 2.39.2