Fix update of children on parent LockPosition change
This commit is contained in:
@@ -109,6 +109,10 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
if (prop == &Source) {
|
||||
updateChildrenSource();
|
||||
}
|
||||
|
||||
if (prop == &LockPosition) {
|
||||
updateChildrenLock();
|
||||
}
|
||||
|
||||
if (prop == &ScaleType) {
|
||||
double newScale = getScale();
|
||||
@@ -129,7 +133,7 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
if (!DrawUtil::fpCompare(Rotation.getValue(),0.0)) {
|
||||
Rotation.setValue(0.0);
|
||||
purgeTouched();
|
||||
Base::Console().Warning("DPG: Projection Groups do not rotate. Change ignored.\n");
|
||||
Base::Console().Log("DPG: Projection Groups do not rotate. Change ignored.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,9 +386,10 @@ App::DocumentObject * DrawProjGroup::addProjection(const char *viewProjType)
|
||||
view->LockPosition.purgeTouched();
|
||||
requestPaint();
|
||||
}
|
||||
|
||||
addView(view); //from DrawViewCollection
|
||||
requestPaint();
|
||||
addView(view); //from DrawViewCollection
|
||||
if (view != getAnchor()) { //anchor is done elsewhere
|
||||
view->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
@@ -787,6 +792,20 @@ void DrawProjGroup::updateChildrenSource(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* tell children DPGIs that parent DPG has changed LockPosition
|
||||
* (really for benefit of QGIV on Gui side)
|
||||
*/
|
||||
void DrawProjGroup::updateChildrenLock(void)
|
||||
{
|
||||
for( const auto it : Views.getValues() ) {
|
||||
auto view( dynamic_cast<DrawProjGroupItem *>(it) );
|
||||
if( view ) {
|
||||
view->requestPaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* check if ProjectionGroup fits on Page
|
||||
*/
|
||||
|
||||
@@ -160,6 +160,7 @@ protected:
|
||||
TechDraw::DrawPage * getPage(void) const;
|
||||
void updateChildren(void);
|
||||
void updateChildrenSource(void);
|
||||
void updateChildrenLock(void);
|
||||
int getViewIndex(const char *viewTypeCStr) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
newPos.setY(item->pos().y());
|
||||
} else if(alignMode == QString::fromLatin1("45slash")) {
|
||||
//this logic is wrong since the constained movement direction is not necessarily 45*
|
||||
Base::Console().Message("QGIV::itemChange - oblique BL-TR\n");
|
||||
// Base::Console().Message("QGIV::itemChange - oblique BL-TR\n");
|
||||
// double dist = ( (newPos.x() - item->pos().x()) +
|
||||
// (item->pos().y() - newPos.y()) ) / 2.0;
|
||||
|
||||
@@ -152,7 +152,7 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
// newPos.setY( item->pos().y() - dist );
|
||||
} else if(alignMode == QString::fromLatin1("45backslash")) {
|
||||
//this logic is wrong since the constained movement direction is not necessarily 45*
|
||||
Base::Console().Message("QGIV::itemChange - oblique TL-BR\n");
|
||||
// Base::Console().Message("QGIV::itemChange - oblique TL-BR\n");
|
||||
// double dist = ( (newPos.x() - item->pos().x()) +
|
||||
// (newPos.y() - item->pos().y()) ) / 2.0;
|
||||
|
||||
@@ -274,6 +274,7 @@ QGIViewClip* QGIView::getClipGroup(void)
|
||||
|
||||
void QGIView::updateView(bool update)
|
||||
{
|
||||
// Base::Console().Message("QGIV::updateView() - %s\n",getViewObject()->getNameInDocument());
|
||||
if (getViewObject()->isLocked()) {
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
} else {
|
||||
@@ -287,7 +288,9 @@ void QGIView::updateView(bool update)
|
||||
setPosition(featX,featY);
|
||||
}
|
||||
|
||||
if (getViewObject()->Rotation.isTouched() ) {
|
||||
double appRotation = getViewObject()->Rotation.getValue();
|
||||
double guiRotation = rotation();
|
||||
if (!TechDraw::DrawUtil::fpCompare(appRotation,guiRotation)) {
|
||||
rotateView();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user