Fix #3810 X/Y Property Update on Locked View
- fixes x/y update when position locked for simple Views and ProjectionGroups.
This commit is contained in:
@@ -72,10 +72,9 @@ DrawView::DrawView(void):
|
||||
mouseMove(false)
|
||||
{
|
||||
static const char *group = "Base";
|
||||
|
||||
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(X ,(0),group,App::Prop_None,"X position of the view on the page in internal units (mm)");
|
||||
ADD_PROPERTY_TYPE(Y ,(0),group,App::Prop_None,"Y position of the view on the page in internal units (mm)");
|
||||
ADD_PROPERTY_TYPE(LockPosition ,(false),group,App::Prop_None,"Lock View position to parent Page or Group");
|
||||
ADD_PROPERTY_TYPE(Rotation ,(0),group,App::Prop_None,"Rotation of the view on the page in degrees counterclockwise");
|
||||
|
||||
ScaleType.setEnums(ScaleTypeEnums);
|
||||
@@ -92,8 +91,9 @@ DrawView::~DrawView()
|
||||
|
||||
App::DocumentObjectExecReturn *DrawView::execute(void)
|
||||
{
|
||||
handleXYLock();
|
||||
requestPaint();
|
||||
return App::DocumentObject::StdReturn; //DO::execute returns 0
|
||||
return App::DocumentObject::execute();
|
||||
}
|
||||
|
||||
void DrawView::checkScale(void)
|
||||
@@ -139,19 +139,54 @@ void DrawView::onChanged(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (prop == &LockPosition) {
|
||||
handleXYLock();
|
||||
}
|
||||
}
|
||||
App::DocumentObject::onChanged(prop);
|
||||
}
|
||||
|
||||
bool DrawView::isLocked(void) const
|
||||
{
|
||||
return LockPosition.getValue();
|
||||
}
|
||||
|
||||
//override this for View inside a group (ex DPGI in DPG)
|
||||
void DrawView::handleXYLock(void)
|
||||
{
|
||||
if (isLocked()) {
|
||||
if (!X.testStatus(App::Property::ReadOnly)) {
|
||||
X.setStatus(App::Property::ReadOnly,true);
|
||||
App::GetApplication().signalChangePropertyEditor(X);
|
||||
X.purgeTouched();
|
||||
}
|
||||
Y.setStatus(App::Property::ReadOnly,true);
|
||||
App::GetApplication().signalChangePropertyEditor(Y);
|
||||
Y.purgeTouched();
|
||||
requestPaint();
|
||||
} else {
|
||||
if (X.testStatus(App::Property::ReadOnly)) {
|
||||
X.setStatus(App::Property::ReadOnly,false);
|
||||
App::GetApplication().signalChangePropertyEditor(X);
|
||||
X.purgeTouched();
|
||||
}
|
||||
Y.setStatus(App::Property::ReadOnly,false);
|
||||
App::GetApplication().signalChangePropertyEditor(Y);
|
||||
Y.purgeTouched();
|
||||
requestPaint();
|
||||
}
|
||||
}
|
||||
|
||||
short DrawView::mustExecute() const
|
||||
{
|
||||
short result = 0;
|
||||
if (!isRestoring()) {
|
||||
result = (Scale.isTouched() ||
|
||||
ScaleType.isTouched() ||
|
||||
X.isTouched() ||
|
||||
Y.isTouched() );
|
||||
ScaleType.isTouched() );
|
||||
if (!isLocked()) {
|
||||
result = result || X.isTouched() ||
|
||||
Y.isTouched() ;
|
||||
}
|
||||
}
|
||||
if ((bool) result) {
|
||||
return result;
|
||||
@@ -168,6 +203,7 @@ QRectF DrawView::getRect() const
|
||||
|
||||
void DrawView::onDocumentRestored()
|
||||
{
|
||||
handleXYLock();
|
||||
DrawView::execute();
|
||||
}
|
||||
|
||||
@@ -251,8 +287,10 @@ bool DrawView::checkFit(TechDraw::DrawPage* p) const
|
||||
|
||||
void DrawView::setPosition(double x, double y)
|
||||
{
|
||||
X.setValue(x);
|
||||
Y.setValue(y);
|
||||
if (!isLocked()) {
|
||||
X.setValue(x);
|
||||
Y.setValue(y);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: getScale is no longer needed and could revert to Scale.getValue
|
||||
|
||||
Reference in New Issue
Block a user