mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-02 12:32:03 +01:00
UI: Only even out the side insets in landscape
In portrait, a camera cutout is at the top, so a one-sided side inset is a real edge and mirroring it just wastes space. The iPhone Duo's cover screen has its sensor bar on the right in portrait, which left an equally wide empty strip on the left of the main screen. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
888abaa97e
commit
cccb296050
1 file changed
+8
-1
@@ -164,11 +164,18 @@ Bounds UIContext::GetLayoutBounds(ViewLayoutMode layoutMode, bool immersiveMode)
|
||||
break;
|
||||
}
|
||||
|
||||
// The side insets are only evened out in landscape. In portrait, a camera cutout is at the top, so a
|
||||
// side inset is a real edge (like the sensor bar on the iPhone Duo's cover screen) and stays as is.
|
||||
const Bounds screenBounds = GetBounds();
|
||||
const bool landscape = screenBounds.w > screenBounds.h;
|
||||
|
||||
if (immersiveMode) {
|
||||
if (!hasCameraCutout) {
|
||||
// No cutout, so if the nav bar is hidden, we can use the full width of the screen.
|
||||
left = 0.0f;
|
||||
right = 0.0f;
|
||||
} else if (!landscape) {
|
||||
// Keep the insets.
|
||||
} else if (left > 0 && right > 0) {
|
||||
// Navigation bar is available, so insets leave space for it
|
||||
// even if it's hidden.
|
||||
@@ -181,7 +188,7 @@ Bounds UIContext::GetLayoutBounds(ViewLayoutMode layoutMode, bool immersiveMode)
|
||||
right = sideWidth;
|
||||
}
|
||||
} else {
|
||||
if ((left > 0) != (right > 0)) {
|
||||
if (landscape && (left > 0) != (right > 0)) {
|
||||
// Only one side has a cutout (surely the camera, which is usually smaller than the nav bar), so use the larger of the two for both sides.
|
||||
int sideWidth = std::max(left, right);
|
||||
left = sideWidth;
|
||||
|
||||
Reference in new issue
Block a user