Restore secondary ortho view movement to v017 style

- this should also complete the fix for #3809
This commit is contained in:
wandererfan
2019-02-08 19:42:23 -05:00
committed by wmayer
parent 2240ba0e2a
commit 9de6ff802a
10 changed files with 100 additions and 76 deletions

View File

@@ -42,6 +42,7 @@
#include <Mod/TechDraw/App/DrawProjGroup.h>
#include "Rez.h"
#include "DrawGuiUtil.h"
#include "QGIProjGroup.h"
using namespace TechDrawGui;
@@ -63,7 +64,6 @@ QGIProjGroup::QGIProjGroup()
borderVisible = false;
}
TechDraw::DrawProjGroup * QGIProjGroup::getDrawView(void) const
{
App::DocumentObject *obj = getViewObject();
@@ -118,12 +118,8 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val
if (type == QString::fromLatin1("Front")) {
gView->setLocked(true); //this locks in GUI only
fView->LockPosition.setValue(true); //lock in App also
gView->alignTo(m_origin, QString::fromLatin1("None"));
installSceneEventFilter(gView);
App::DocumentObject *docObj = getViewObject();
TechDraw::DrawProjGroup *projectionGroup = dynamic_cast<TechDraw::DrawProjGroup *>(docObj);
projectionGroup->Anchor.setValue(fView);
updateView();
} else if ( type == QString::fromLatin1("Top") ||
type == QString::fromLatin1("Bottom")) {
gView->alignTo(m_origin, QString::fromLatin1("Vertical"));
@@ -131,7 +127,13 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val
type == QString::fromLatin1("Right") ||
type == QString::fromLatin1("Rear") ) {
gView->alignTo(m_origin, QString::fromLatin1("Horizontal"));
}
} else if ( type == QString::fromLatin1("FrontTopRight") ||
type == QString::fromLatin1("FrontBottomLeft") ) {
gView->alignTo(m_origin, QString::fromLatin1("45slash"));
} else if ( type == QString::fromLatin1("FrontTopLeft") ||
type == QString::fromLatin1("FrontBottomRight") ) {
gView->alignTo(m_origin, QString::fromLatin1("45backslash"));
}
}
}
}
@@ -168,24 +170,17 @@ void QGIProjGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
QGIView *qAnchor = getAnchorQItem();
if((mousePos - event->screenPos()).manhattanLength() < 5) {
if(qAnchor && qAnchor->shape().contains(event->pos())) {
qAnchor->mouseReleaseEvent(event);
event->ignore();
qAnchor->mouseReleaseEvent(event);
}
} else if(scene() && qAnchor && (qAnchor == scene()->mouseGrabberItem())) {
} else if(scene() && qAnchor) {
// End of Drag
Gui::Command::openCommand("Drag Projection Group");
//TODO: See if these commands actually handle the horizontal/vertical constraints properly...
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.X = %f",
getViewName(), Rez::appX(x()));
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Y = %f",
getViewName(), Rez::appX(getY()));// inverts Y
Gui::Command::commitCommand();
//Gui::Command::updateActive();
getViewObject()->setPosition(Rez::appX(x()),Rez::appX(getY()));
}
}
QGIViewCollection::mouseReleaseEvent(event);
}
QGIView * QGIProjGroup::getAnchorQItem() const
{
// Get the currently assigned anchor view