mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 23:40:39 +00:00
Add a new centering capability to AnchorLayout
This commit is contained in:
parent
fb5474115c
commit
b938992da4
@ -1272,6 +1272,9 @@ void AnchorLayout::Layout() {
|
||||
if (center) {
|
||||
vBounds.x += vBounds.w * 0.5f;
|
||||
}
|
||||
} else {
|
||||
// Both left and right are NONE. Center.
|
||||
vBounds.x = (bounds_.w - vBounds.w) / 2.0f + bounds_.x;
|
||||
}
|
||||
|
||||
if (top > NONE) {
|
||||
@ -1282,6 +1285,9 @@ void AnchorLayout::Layout() {
|
||||
vBounds.y = bounds_.y2() - bottom - vBounds.h;
|
||||
if (center)
|
||||
vBounds.y += vBounds.h * 0.5f;
|
||||
} else {
|
||||
// Both top and bottom are NONE. Center.
|
||||
vBounds.y = (bounds_.h - vBounds.h) / 2.0f + bounds_.y;
|
||||
}
|
||||
|
||||
views_[i]->SetBounds(vBounds);
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
|
||||
// These are not bounds, but distances from the container edges.
|
||||
// Set to NONE to not attach this edge to the container.
|
||||
// If two opposite edges are NONE, centering will happen.
|
||||
float left, top, right, bottom;
|
||||
bool center; // If set, only two "sides" can be set, and they refer to the center, not the edge, of the view being layouted.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user