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:
parent
e67e7dd995
commit
524c020956
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user