Center new view on Page/ClipGroup
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user