[TD]fix positioning of secondary views

This commit is contained in:
wandererfan
2024-01-01 09:01:58 -05:00
committed by WandererFan
parent 70bc10a5d9
commit 4e6dc1ca50

View File

@@ -163,6 +163,7 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
if(change == ItemPositionChange && scene()) {
newPos = value.toPointF(); //position within parent!
if(m_locked){
// ignore position change for locked items
newPos.setX(pos().x());
newPos.setY(pos().y());
return newPos;
@@ -170,9 +171,8 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
TechDraw::DrawView *viewObj = getViewObject();
// TODO find a better data structure for this
// this is just a pair isn't it?
if (viewObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
// restrict movements of secondary views.
TechDraw::DrawProjGroupItem* dpgi = static_cast<TechDraw::DrawProjGroupItem*>(viewObj);
TechDraw::DrawProjGroup* dpg = dpgi->getPGroup();
if (dpg) {
@@ -186,11 +186,11 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
}
}
}
} else {
Gui::ViewProvider *vp = getViewProvider(viewObj);
if (vp && !vp->isRestoring()) {
viewObj->setPosition(Rez::appX(newPos.x()), Rez::appX(-newPos.y()));
}
}
// tell the feature that we have moved
Gui::ViewProvider *vp = getViewProvider(viewObj);
if (vp && !vp->isRestoring()) {
viewObj->setPosition(Rez::appX(newPos.x()), Rez::appX(-newPos.y()));
}
return newPos;