1.1 --- a/mapeditor.cpp Thu Sep 17 09:41:09 2009 +0000
1.2 +++ b/mapeditor.cpp Wed Sep 23 11:59:54 2009 +0000
1.3 @@ -1183,22 +1183,26 @@
1.4 }
1.5 } else
1.6 { // selection != a FloatObj
1.7 - if (seli->depth()==0) //FIXME-1 also moved mapcenters could be linked, but not working here...
1.8 + if (seli->depth()==0) //FIXME-1 also moved mapcenters could be linked, but not working so far
1.9 {
1.10 - // Move MapCenter
1.11 + // Move MapCenter // FIXME-1 scrolls way too much with shift pressed
1.12 + lmosel->move (p-movingObj_start);
1.13 if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier)
1.14 - ((BranchObj*)lmosel)->moveBy(
1.15 - QPointF(p.x() -movingObj_start.x(),
1.16 - p.y()-movingObj_start.y()) );
1.17 - else
1.18 - lmosel->move (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
1.19 - model->updateRelPositions();
1.20 + {
1.21 + QPointF v;
1.22 + v=lmosel->getAbsPos();
1.23 + for (int i=0; i<seli->branchCount(); ++i)
1.24 + {
1.25 + seli->getBranchObjNum(i)->setRelPos();
1.26 + seli->getBranchObjNum(i)->setOrientation();
1.27 + }
1.28 + }
1.29 } else
1.30 {
1.31 if (seli->depth()==1)
1.32 {
1.33 // Move mainbranch
1.34 - lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
1.35 + lmosel->move(p-movingObj_start);
1.36 lmosel->setRelPos();
1.37 } else
1.38 {
1.39 @@ -1214,7 +1218,7 @@
1.40
1.41 } // depth>0
1.42 // Maybe we can relink temporary?
1.43 - if (dsti)
1.44 + if (dsti) // FIXME-1 check if dsti is ancestor of myself!
1.45 {
1.46 if (e->modifiers()==Qt::ControlModifier)
1.47 {
1.48 @@ -1585,6 +1589,8 @@
1.49 QList <TreeItem*> treeItemsNew;
1.50 QList <TreeItem*> treeItemsOld;
1.51
1.52 + bool do_reposition=false;
1.53 +
1.54 QModelIndex ix;
1.55 foreach (ix,newsel.indexes() )
1.56 {
1.57 @@ -1616,7 +1622,8 @@
1.58 {
1.59 // reset tmp scrolled branches
1.60 BranchItem *bi=(BranchItem*)ti;
1.61 - bi->resetTmpUnscroll();
1.62 + if (bi->resetTmpUnscroll() )
1.63 + do_reposition=true;
1.64 }
1.65 if (ti->isBranchLikeType() || ti->getType()==TreeItem::Image)
1.66 // Hide link if not needed
1.67 @@ -1636,7 +1643,10 @@
1.68 {
1.69 BranchItem *bi=(BranchItem*)ti;
1.70 if (bi->hasScrolledParent(bi) )
1.71 - bi->tmpUnscroll();
1.72 + {
1.73 + if (bi->parentBranch()->tmpUnscroll() )
1.74 + do_reposition=true;
1.75 + }
1.76 }
1.77 scrollTo (ix);
1.78 if (ti->isBranchLikeType() || ti->getType()==TreeItem::Image)
1.79 @@ -1644,6 +1654,7 @@
1.80 ((MapItem*)ti)->getLMO()->updateVisibility();
1.81 }
1.82 }
1.83 + if (do_reposition) model->reposition();
1.84
1.85 // Reduce rectangles
1.86 while (treeItemsNew.count() < selboxList.count() )
1.87 @@ -1663,7 +1674,6 @@
1.88 }
1.89
1.90
1.91 -
1.92 // Reposition rectangles
1.93 QRectF bbox;
1.94 QModelIndex index;