diff --git a/src/Mod/TechDraw/App/DrawProjGroup.cpp b/src/Mod/TechDraw/App/DrawProjGroup.cpp index 22e4f730f5..66f65b9449 100644 --- a/src/Mod/TechDraw/App/DrawProjGroup.cpp +++ b/src/Mod/TechDraw/App/DrawProjGroup.cpp @@ -651,6 +651,8 @@ gp_Dir DrawProjGroup::vec2dir(Base::Vector3d v) //this can be improved. this implementation positions views too far apart. Base::Vector3d DrawProjGroup::getXYPosition(const char *viewTypeCStr) { +// Base::Console().Message("DPG::getXYPosition(%s)\n",Label.getValue()); + Base::Vector3d result(0.0,0.0,0.0); //Front view position is always (0,0) if (strcmp(viewTypeCStr, "Front") == 0 ) { // Front! @@ -664,6 +666,12 @@ Base::Vector3d DrawProjGroup::getXYPosition(const char *viewTypeCStr) //TODO: bounding boxes do not take view orientation into account // i.e. X&Y widths might be swapped on page + if (viewPtrs[viewIndex]->LockPosition.getValue()) { + result.x = viewPtrs[viewIndex]->X.getValue(); + result.y = viewPtrs[viewIndex]->Y.getValue(); + return result; + } + if (AutoDistribute.getValue()) { std::vector position(idxCount); diff --git a/src/Mod/TechDraw/App/DrawProjGroupItem.cpp b/src/Mod/TechDraw/App/DrawProjGroupItem.cpp index 8155af34ff..c26a769864 100644 --- a/src/Mod/TechDraw/App/DrawProjGroupItem.cpp +++ b/src/Mod/TechDraw/App/DrawProjGroupItem.cpp @@ -129,9 +129,9 @@ bool DrawProjGroupItem::showLock(void) const App::DocumentObjectExecReturn *DrawProjGroupItem::execute(void) { // Base::Console().Message("DPGI::execute(%s)\n",Label.getValue()); - if (!keepUpdated()) { - return App::DocumentObject::StdReturn; - } + if (!keepUpdated()) { + return App::DocumentObject::StdReturn; + } bool haveX = checkXDirection(); if (!haveX) { @@ -155,17 +155,18 @@ App::DocumentObjectExecReturn *DrawProjGroupItem::execute(void) void DrawProjGroupItem::autoPosition() { // Base::Console().Message("DPGI::autoPosition(%s)\n",Label.getValue()); + if (LockPosition.getValue()) { + return; + } auto pgroup = getPGroup(); Base::Vector3d newPos; if (pgroup != nullptr) { if (pgroup->AutoDistribute.getValue()) { - if (!LockPosition.getValue()) { - newPos = pgroup->getXYPosition(Type.getValueAsString()); - X.setValue(newPos.x); - Y.setValue(newPos.y); - requestPaint(); - purgeTouched(); //prevents "still touched after recompute" message - } + newPos = pgroup->getXYPosition(Type.getValueAsString()); + X.setValue(newPos.x); + Y.setValue(newPos.y); + requestPaint(); + purgeTouched(); //prevents "still touched after recompute" message } } } diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp index b43b9ea64a..48d557f61c 100644 --- a/src/Mod/TechDraw/Gui/QGIView.cpp +++ b/src/Mod/TechDraw/Gui/QGIView.cpp @@ -424,19 +424,9 @@ void QGIView::draw() if (getViewObject() != nullptr) { x = Rez::guiX(getViewObject()->X.getValue()); y = Rez::guiX(getViewObject()->Y.getValue()); - if (getFrameState()) { - //+/- space for label if DPGI - TechDraw::DrawProjGroupItem* dpgi = dynamic_cast(getViewObject()); - if (dpgi != nullptr) { - double vertLabelSpace = Rez::guiX(Preferences::labelFontSizeMM()); - if (y > 0) { - y += vertLabelSpace; - } else if (y < 0) { - y -= vertLabelSpace; - } - } + if (!getViewObject()->LockPosition.getValue()) { + setPosition(x, y); } - setPosition(x, y); } if (isVisible()) { drawBorder(); @@ -453,7 +443,6 @@ void QGIView::drawCaption() QRectF displayArea = customChildrenBoundingRect(); m_caption->setDefaultTextColor(m_colCurrent); m_font.setFamily(getPrefFont()); -// m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize())); m_font.setPixelSize(PreferencesGui::labelFontSizePX()); m_caption->setFont(m_font); QString captionStr = QString::fromUtf8(getViewObject()->Caption.getValue()); @@ -466,7 +455,6 @@ void QGIView::drawCaption() if (getFrameState() || vp->KeepLabel.getValue()) { //place below label if label visible m_caption->setY(displayArea.bottom() + labelHeight); } else { -// m_caption->setY(displayArea.bottom() + labelCaptionFudge * getPrefFontSize()); m_caption->setY(displayArea.bottom() + labelCaptionFudge * Preferences::labelFontSizeMM()); } m_caption->show(); @@ -496,7 +484,6 @@ void QGIView::drawBorder() m_label->setDefaultTextColor(m_colCurrent); m_font.setFamily(getPrefFont()); -// m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize())); m_font.setPixelSize(PreferencesGui::labelFontSizePX()); m_label->setFont(m_font);