Allow View Position to be Locked

- prevents accidently moving View A from desired position
  while grabbing/dragging View B.
This commit is contained in:
WandererFan
2018-01-09 18:59:39 -05:00
committed by Yorik van Havre
parent b6296395e2
commit 1e7aa621f1
3 changed files with 7 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ DrawView::DrawView(void)
ADD_PROPERTY_TYPE(X ,(0),group,App::Prop_None,"X position of the view on the page in modelling units (mm)");
ADD_PROPERTY_TYPE(Y ,(0),group,App::Prop_None,"Y position of the view on the page in modelling units (mm)");
ADD_PROPERTY_TYPE(LockPosition ,(false),group,App::Prop_None,"Prevent View from moving in Gui");
ADD_PROPERTY_TYPE(Rotation ,(0),group,App::Prop_None,"Rotation of the view on the page in degrees counterclockwise");
ScaleType.setEnums(ScaleTypeEnums);

View File

@@ -50,6 +50,7 @@ public:
App::PropertyFloat X;
App::PropertyFloat Y;
App::PropertyBool LockPosition;
App::PropertyFloatConstraint Scale;
App::PropertyEnumeration ScaleType;

View File

@@ -257,6 +257,11 @@ double QGIView::getYInClip(double y)
void QGIView::updateView(bool update)
{
if (getViewObject()->LockPosition.getValue()) {
setFlag(QGraphicsItem::ItemIsMovable, false);
} else {
setFlag(QGraphicsItem::ItemIsMovable, true);
}
if (update ||
getViewObject()->X.isTouched() ||
getViewObject()->Y.isTouched()) {