Skip to content

Commit fbc952f

Browse files
committed
Fix View.background modifier maximum size calculation
Discovered the issue when I was working on the sudoku example and encountered some pretty extreme layout performance issues. Tracked down the cause to the background modifier's incorrect maximum size calculation bypassing ViewGraphNode's view size caching.
1 parent f5df8b0 commit fbc952f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftCrossUI/Modifiers/Background.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ struct BackgroundModifier<Background: View, Foreground: View>: TypeSafeView {
7878
idealSize: foregroundSize.idealSize,
7979
minimumWidth: max(backgroundSize.minimumWidth, foregroundSize.minimumWidth),
8080
minimumHeight: max(backgroundSize.minimumHeight, foregroundSize.minimumHeight),
81-
maximumWidth: max(backgroundSize.maximumWidth, foregroundSize.maximumWidth),
82-
maximumHeight: max(backgroundSize.maximumHeight, foregroundSize.maximumHeight)
81+
maximumWidth: min(backgroundSize.maximumWidth, foregroundSize.maximumWidth),
82+
maximumHeight: min(backgroundSize.maximumHeight, foregroundSize.maximumHeight)
8383
),
8484
childResults: [backgroundResult, foregroundResult]
8585
)

0 commit comments

Comments
 (0)