mirror of
https://github.com/yattee/yattee.git
synced 2026-10-27 15:07:18 +00:00
Keep the landscape panel hidden where the corner layout doesn't fit
The corner preset's landscape fallback opened the panel whenever the device could host the corner layout. On the iPhone Duo exterior display the player falls back to the widescreen layout, so the floating panel opened on every rotation into landscape. Resolve the fallback from whether the corner layout fits the current size instead.
This commit is contained in:
@@ -500,12 +500,20 @@ struct PanelSettings: Codable, Hashable, Sendable {
|
||||
/// landscape in the corner layout on a device that can show it, where the
|
||||
/// panels are the point of the layout and open visible.
|
||||
func effectiveDefaultVisibility(for orientation: PanelOrientation) -> PanelDefaultVisibility {
|
||||
effectiveDefaultVisibility(for: orientation, cornerLayoutFits: Self.canHostCornerLayout)
|
||||
}
|
||||
|
||||
/// Same as `effectiveDefaultVisibility(for:)`, but the corner fallback
|
||||
/// follows whether the corner layout fits the current screen — the iPhone
|
||||
/// Duo exterior display can't host it and falls back to the floating
|
||||
/// widescreen panel, which must not open by default.
|
||||
func effectiveDefaultVisibility(for orientation: PanelOrientation, cornerLayoutFits: Bool) -> PanelDefaultVisibility {
|
||||
switch orientation {
|
||||
case .portrait:
|
||||
return portraitDefaultVisibility ?? defaultVisibility ?? .visible
|
||||
case .landscape:
|
||||
let fallback: PanelDefaultVisibility =
|
||||
effectiveLayoutMode == .corner && Self.canHostCornerLayout ? .visible : .hidden
|
||||
effectiveLayoutMode == .corner && cornerLayoutFits ? .visible : .hidden
|
||||
return landscapeDefaultVisibility ?? defaultVisibility ?? fallback
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user