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();
}

View File

@@ -58,9 +58,8 @@ const char* DrawView::ScaleTypeEnums[]= {"Document",
PROPERTY_SOURCE(TechDraw::DrawView, App::DocumentObject)
DrawView::DrawView(void)
: autoPos(true)
{
static const char *group = "Drawing view";
ADD_PROPERTY_TYPE(X ,(0),group,App::Prop_None,"X position of the view on the page in modelling units (mm)");
@@ -73,8 +72,6 @@ DrawView::DrawView(void)
if (isRestoring()) {
autoPos = false;
} else {
autoPos = true;
}
}