@@ -111,91 +111,3 @@ public struct Offset: Equatable, Hashable, Sendable {
111111 }
112112}
113113
114- /// Placement options for positioning UI elements relative to an anchor.
115- ///
116- /// Placement defines how a UI element (such as a menu or popover) should be
117- /// positioned relative to a reference point or rectangle.
118- ///
119- /// Example:
120- /// ```swift
121- /// // Position menu below the anchor, horizontally centered
122- /// menu.open(strategy, placement: .bottom)
123- ///
124- /// // Position menu below the anchor, aligned to the left
125- /// menu.open(strategy, placement: .bottomStart)
126- ///
127- /// // Position menu above the anchor, aligned to the right
128- /// menu.open(strategy, placement: .topEnd)
129- /// ```
130- public enum Placement : Int32 , CaseIterable {
131- /// Position above the anchor, horizontally centered.
132- case top = 0
133-
134- /// Position above the anchor, aligned to the start (left).
135- case topStart = 1
136-
137- /// Position above the anchor, aligned to the end (right).
138- case topEnd = 2
139-
140- /// Position to the right of the anchor, vertically centered.
141- case right = 3
142-
143- /// Position to the right of the anchor, aligned to the start (top).
144- case rightStart = 4
145-
146- /// Position to the right of the anchor, aligned to the end (bottom).
147- case rightEnd = 5
148-
149- /// Position below the anchor, horizontally centered.
150- case bottom = 6
151-
152- /// Position below the anchor, aligned to the start (left).
153- case bottomStart = 7
154-
155- /// Position below the anchor, aligned to the end (right).
156- case bottomEnd = 8
157-
158- /// Position to the left of the anchor, vertically centered.
159- case left = 9
160-
161- /// Position to the left of the anchor, aligned to the start (top).
162- case leftStart = 10
163-
164- /// Position to the left of the anchor, aligned to the end (bottom).
165- case leftEnd = 11
166-
167- internal var nativeValue : native_placement_t {
168- switch self {
169- case . top: return NATIVE_PLACEMENT_TOP
170- case . topStart: return NATIVE_PLACEMENT_TOP_START
171- case . topEnd: return NATIVE_PLACEMENT_TOP_END
172- case . right: return NATIVE_PLACEMENT_RIGHT
173- case . rightStart: return NATIVE_PLACEMENT_RIGHT_START
174- case . rightEnd: return NATIVE_PLACEMENT_RIGHT_END
175- case . bottom: return NATIVE_PLACEMENT_BOTTOM
176- case . bottomStart: return NATIVE_PLACEMENT_BOTTOM_START
177- case . bottomEnd: return NATIVE_PLACEMENT_BOTTOM_END
178- case . left: return NATIVE_PLACEMENT_LEFT
179- case . leftStart: return NATIVE_PLACEMENT_LEFT_START
180- case . leftEnd: return NATIVE_PLACEMENT_LEFT_END
181- }
182- }
183-
184- internal init ( nativeValue: native_placement_t ) {
185- switch nativeValue {
186- case NATIVE_PLACEMENT_TOP: self = . top
187- case NATIVE_PLACEMENT_TOP_START: self = . topStart
188- case NATIVE_PLACEMENT_TOP_END: self = . topEnd
189- case NATIVE_PLACEMENT_RIGHT: self = . right
190- case NATIVE_PLACEMENT_RIGHT_START: self = . rightStart
191- case NATIVE_PLACEMENT_RIGHT_END: self = . rightEnd
192- case NATIVE_PLACEMENT_BOTTOM: self = . bottom
193- case NATIVE_PLACEMENT_BOTTOM_START: self = . bottomStart
194- case NATIVE_PLACEMENT_BOTTOM_END: self = . bottomEnd
195- case NATIVE_PLACEMENT_LEFT: self = . left
196- case NATIVE_PLACEMENT_LEFT_START: self = . leftStart
197- case NATIVE_PLACEMENT_LEFT_END: self = . leftEnd
198- default : self = . bottomStart
199- }
200- }
201- }
0 commit comments