+ fix method ViewProviderDocumentObject::getActiveView()

+ fix SoAutoZoomTranslation and SoZoomTranslation to get correct scaling factor
(do not rely on active view because this can be the wrong one and thus delivers wrong results)
This commit is contained in:
wmayer
2015-09-16 11:32:35 +02:00
parent 470b9ff756
commit 6dfc395a06
5 changed files with 41 additions and 46 deletions

View File

@@ -38,6 +38,7 @@
#include "Application.h"
#include "Document.h"
#include "Selection.h"
#include "MainWindow.h"
#include "MDIView.h"
#include "TaskView/TaskAppearance.h"
#include "ViewProviderDocumentObject.h"
@@ -160,7 +161,20 @@ Gui::MDIView* ViewProviderDocumentObject::getActiveView() const
{
App::Document* pAppDoc = pcObject->getDocument();
Gui::Document* pGuiDoc = Gui::Application::Instance->getDocument(pAppDoc);
return pGuiDoc->getActiveView();
MDIView* active = getMainWindow()->activeWindow();
std::list<MDIView*> views = pGuiDoc->getViewsOfViewProvider(const_cast<ViewProviderDocumentObject*>(this));
// is the active window a 3d view and does it contain this view provider
std::list<MDIView*>::iterator it = std::find(views.begin(), views.end(), active);
if (it != views.end())
return *it;
// if there is a 3d view containing this view provider return the first one
else if (!views.empty())
return views.front();
// no 3d view found containing this view provider
else
return 0;
}
Gui::MDIView* ViewProviderDocumentObject::getEditingView() const