Bounds() takes into account previous pushed states

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13157 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-06-15 18:47:41 +00:00
parent e67e7dd995
commit 524c020956
2 changed files with 26 additions and 2 deletions

View File

@ -1019,8 +1019,31 @@ Layer::ResizeBy(float x, float y)
BPoint
Layer::BoundsOrigin() const
{
// TODO: add origin from previous states
return fLayerData->Origin();
BPoint origin(0,0);
float scale = Scale();
LayerData *ld = fLayerData;
do {
origin += ld->Origin();
} while ((ld = ld->prevState));
origin.x *= scale;
origin.y *= scale;
return origin;
}
float
Layer::Scale() const
{
float scale = 1.0f;
LayerData *ld = fLayerData;
do {
scale += ld->Scale();
} while ((ld = ld->prevState));
return scale;
}
//! Converts the passed point to parent coordinates

View File

@ -131,6 +131,7 @@ class Layer {
virtual void ResizeBy(float x, float y);
BPoint BoundsOrigin() const; // BoundsFrameDiff()?
float Scale() const;
BPoint ConvertToParent(BPoint pt);
BRect ConvertToParent(BRect rect);