File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Sources/MarkdownUI/Views/Blocks Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -40,5 +40,30 @@ struct ListItemView: View {
4040 . readWidth ( column: 0 )
4141 . frame ( width: self . markerWidth, alignment: . trailing)
4242 }
43+ #if os(visionOS)
44+ . labelStyle( BulletItemStyle ( ) )
45+ #endif
4346 }
4447}
48+
49+
50+ extension VerticalAlignment {
51+ private enum CenterOfFirstLine : AlignmentID {
52+ static func defaultValue( in context: ViewDimensions ) -> CGFloat {
53+ let heightAfterFirstLine = context [ . lastTextBaseline] - context[ . firstTextBaseline]
54+ let heightOfFirstLine = context. height - heightAfterFirstLine
55+ return heightOfFirstLine / 2
56+ }
57+ }
58+ static let centerOfFirstLine = Self ( CenterOfFirstLine . self)
59+ }
60+
61+
62+ struct BulletItemStyle : LabelStyle {
63+ func makeBody( configuration: Configuration ) -> some View {
64+ HStack ( alignment: . centerOfFirstLine, spacing: 4 ) {
65+ configuration. icon
66+ configuration. title
67+ }
68+ }
69+ }
You can’t perform that action at this time.
0 commit comments