Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions VisionOS-Examples/Model/OrnamentAlignment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ enum OrnamentAlignment: String {
case leading
case center

var unitPoint: UnitPoint {
switch self {
case .top:
return .top
case .trailing:
return .trailing
case .bottom:
return .bottom
case .topTrailing:
return .topTrailing
case .bottomTrailing:
return .bottomTrailing
case .leading:
return .leading
case .center:
return .center
}
}

var alignment: Alignment {
switch self {
case .top:
Expand Down
4 changes: 2 additions & 2 deletions VisionOS-Examples/Pages/OrnamentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct OrnamentView: View {
}
.ornament(
visibility: showOrnament ? .visible : .hidden,
attachmentAnchor: .scene(alignment: ornamentPosition.alignment),
attachmentAnchor: .scene(ornamentPosition.unitPoint),
contentAlignment: contentAlignment.alignment) {
Text("Ornament Content")
.padding()
Expand All @@ -109,7 +109,7 @@ struct OrnamentView: View {

.ornament(
visibility: showLargeOrnament ? .visible : .hidden,
attachmentAnchor: .scene(alignment: largeOrnamentPosition.alignment),
attachmentAnchor: .scene(ornamentPosition.unitPoint),
contentAlignment: largeContentAlignment.alignment) {
VStack {
Text("Title")
Expand Down