branchobj.cpp
changeset 815 2881c4424190
parent 814 31de6677aa96
child 817 b486ffd0fa11
     1.1 --- a/branchobj.cpp	Thu Dec 03 22:32:24 2009 +0000
     1.2 +++ b/branchobj.cpp	Mon Dec 07 21:56:46 2009 +0000
     1.3 @@ -125,7 +125,7 @@
     1.4  
     1.5  	BranchItem *pi=(BranchItem*)(dsti->parent());
     1.6  	int pi_depth=pi->depth();
     1.7 -	BranchObj* bo=(BranchObj*)dst;
     1.8 +	BranchObj* bodst=(BranchObj*)dst;
     1.9  
    1.10  	if (!tmpParent) 
    1.11  	{
    1.12 @@ -138,7 +138,7 @@
    1.13  		link2ParPos=false;
    1.14  	else
    1.15  		link2ParPos=true;
    1.16 -	parObj=bo;
    1.17 +	parObj=bodst;
    1.18  
    1.19  	setLinkStyle (dst->getDefLinkStyle (dsti));
    1.20   
    1.21 @@ -146,10 +146,10 @@
    1.22  	// Usually the positioning would be done by reposition(),
    1.23  	// but then also the destination branch would "Jump" around...
    1.24  	// Better just do it approximately
    1.25 -	cout << "BO::setTmp  d="<<dsti->depth();
    1.26 +	cout << "BO::setTmp ";
    1.27  	if (dsti->depth()==0)	
    1.28  	{	// new parent is a mapcenter
    1.29 -		Vector v= ( m - bo->getChildPos());
    1.30 +		Vector v= ( m - bodst->getChildPos());
    1.31  		if (v.x()<0) v.setX( v.x()-bbox.width() );
    1.32  		v.normalize();
    1.33  		v.scale (100);
    1.34 @@ -161,28 +161,33 @@
    1.35  		if (off==0)
    1.36  		{
    1.37  			// new parent is just a branch, link to it
    1.38 -			QRectF t=bo->getBBoxSizeWithChildren();
    1.39 +			QRectF t=bodst->getBBoxSizeWithChildren();
    1.40  			if (dsti->getLastBranch())
    1.41  				y=t.y() + t.height() ;
    1.42  			else
    1.43  				y=t.y();
    1.44  
    1.45 +			y=t.bottom();
    1.46 +			cout << "  y="<<y;		
    1.47 +			cout << "  t.h="<<t.height();
    1.48 +
    1.49  		} else
    1.50  		{
    1.51  			if (off<0)
    1.52  				// we want to link above dst
    1.53 -				y=bo->y() - height() + 5;
    1.54 +				y=bodst->y() - height() + 5;
    1.55  			else	
    1.56  				// we want to link below dst
    1.57  				// Bottom of sel should be 5 pixels above
    1.58  				// the bottom of the branch _below_ the target:
    1.59  				// Don't try to find that branch, guess 12 pixels
    1.60 -				y=bo->getChildPos().y()  -height() + 12; 
    1.61 +				y=bodst->getChildPos().y()  -height() + 12; 
    1.62  		}	
    1.63 -		if (bo->getOrientation()==LinkableMapObj::LeftOfCenter)
    1.64 -			move ( bo->getChildPos().x() - linkwidth, y );
    1.65 +		cout << "  pos="<<getAbsPos()<<" cPos="<<bodst->getChildPos()<<endl;
    1.66 +		if (bodst->getOrientation()==LinkableMapObj::LeftOfCenter)
    1.67 +			move ( bodst->getChildPos().x() - linkwidth, y );
    1.68  		else	
    1.69 -			move (bo->getChildPos().x() + linkwidth, y );
    1.70 +			move (bodst->getChildPos().x() + linkwidth, y );
    1.71  	}	
    1.72  
    1.73  	// updateLinkGeometry is called implicitly in move