Center new view on Page/ClipGroup

This commit is contained in:
WandererFan
2016-07-20 12:40:24 -04:00
committed by wmayer
parent ac32ab0b00
commit efbb08a136
3 changed files with 9 additions and 24 deletions

View File

@@ -237,11 +237,19 @@ int DrawPage::addView(App::DocumentObject *docObj)
if(!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()))
return -1;
//position all new views in center of Page (exceptDVDimension)
DrawView* view = dynamic_cast<DrawView*>(docObj);
if (!docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) {
view->X.setValue(getPageWidth()/2.0);
view->Y.setValue(getPageHeight()/2.0);
}
const std::vector<App::DocumentObject *> currViews = Views.getValues();
std::vector<App::DocumentObject *> newViews(currViews);
newViews.push_back(docObj);
Views.setValues(newViews);
Views.touch();
return Views.getSize();
}