mapobj.cpp
changeset 178 8e3d07807ac5
parent 166 325958acb69b
child 227 38ad83f1d4ce
     1.1 --- a/mapobj.cpp	Mon Oct 10 11:20:25 2005 +0000
     1.2 +++ b/mapobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.3 @@ -82,17 +82,22 @@
     1.4      absPos.setX( xi);
     1.5      absPos.setY( yi);
     1.6      bbox.moveTopLeft(QPoint(xi,yi));
     1.7 +    clickBox.moveTopLeft(QPoint(xi,yi));
     1.8  }
     1.9  
    1.10  void MapObj::moveBy (double x, double y) 
    1.11  {
    1.12 +	int ix=(int)x;
    1.13 +	int iy=(int)y;
    1.14      move (x+absPos.x(),y+absPos.y() );
    1.15 +	bbox.moveBy (ix,iy);
    1.16 +	clickBox.moveBy (ix,iy);
    1.17  }
    1.18  
    1.19 -bool MapObj::inBBox(QPoint p)
    1.20 +bool MapObj::inBox(const QPoint &p)
    1.21  {
    1.22 -    if (p.x() >= bbox.left() && p.x() <= bbox.right()  
    1.23 -	&& p.y() <= bbox.bottom() && p.y() >= bbox.top() )
    1.24 +    if (p.x() >= clickBox.left() && p.x() <= clickBox.right()  
    1.25 +	&& p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
    1.26  		return true;
    1.27      return false;	
    1.28  }
    1.29 @@ -103,7 +108,9 @@
    1.30  }
    1.31  
    1.32  QRect MapObj::addBBox(QRect r1, QRect r2)
    1.33 -{
    1.34 +{	
    1.35 +	// Find smallest QRect containing given rectangles
    1.36 +
    1.37  	QRect n;
    1.38  	// Set left border
    1.39  	if (r1.left() <= r2.left() )