Skip to content

Commit 1597940

Browse files
committed
Optimize RootGeometry
1 parent 43f787d commit 1597940

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Sources/OpenSwiftUICore/View/Graph/ViewGraph.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -634,20 +634,18 @@ package struct RootGeometry: Rule, AsyncAttribute {
634634
origin += (proposal-fittingSize) * 0.5
635635
}
636636

637-
// For RTL layout, adjust the x position to maintain proper visual alignment
638-
if let layoutDirection, layoutDirection == .rightToLeft {
639-
// This flips the x-coordinate to maintain proper visual layout in RTL mode
640-
origin.x = proposedSize.width - CGRect(origin: origin, size: fittingSize).maxX
641-
}
642-
643-
return ViewGeometry(
637+
var geometry = ViewGeometry(
644638
origin: ViewOrigin(origin),
645639
dimensions: ViewDimensions(
646640
guideComputer: layoutComputer,
647641
size: fittingSize,
648642
proposal: .init(proposal)
649643
)
650644
)
645+
if let layoutDirection {
646+
geometry.finalizeLayoutDirection(layoutDirection, parentSize: proposedSize.value)
647+
}
648+
return geometry
651649
}
652650
}
653651

0 commit comments

Comments
 (0)