Zum Inhalt

apple/PhysarumApp/Sources/App/EditorPresentation.swift

#if !os(tvOS)
import CoreGraphics

/// How the workspace is laid out relative to the always-on player.
/// - `.splitColumns`: three-column NavigationSplitView (regular width — iPad-landscape / Mac).
/// - `.overlaySheets`: full-bleed player with editor/library as sheets (compact / iPad-portrait).
enum WorkspaceLayout { case splitColumns, overlaySheets }

/// Maps platform + size class + geometry to a layout mode.
/// - macOS → always `.splitColumns`.
/// - compact width (iPhone, iPad split-view/slide-over) → always `.overlaySheets`.
/// - regular width (iPad full-screen) → `.splitColumns` in landscape (w > h),
///   `.overlaySheets` in portrait/square (ambiance-first, the "living picture").
func workspaceLayout(isMac: Bool, isCompactWidth: Bool, size: CGSize) -> WorkspaceLayout {
    if isMac { return .splitColumns }
    if isCompactWidth { return .overlaySheets }
    return size.width > size.height ? .splitColumns : .overlaySheets
}
#endif