pub enum OverlayAnchor {
Point {
position: Point,
offset: Point,
},
Element {
placement: AnchorPlacement,
gap: f32,
offset: Point,
},
}Expand description
锚点策略:state 拿不到全局几何,由 tree 在执行期解析
两种模式:
- Point:窗口绝对定位(光标位置 / Dialog 中心 / 任意全局坐标), 可选 offset 做微调(正=下/右,负=上/左)
- Element:相对某个 element 定位,用 placement(九宫格)决定方位、 gap 控制间距、offset 做位置微调(如触发组件不在正中心弹出)
Variants§
Implementations§
Source§impl OverlayAnchor
impl OverlayAnchor
Sourcepub fn point_with_offset(position: Point, offset: Point) -> Self
pub fn point_with_offset(position: Point, offset: Point) -> Self
便捷构造:窗口绝对定位 + 偏移
Sourcepub fn element(placement: AnchorPlacement, gap: f32) -> Self
pub fn element(placement: AnchorPlacement, gap: f32) -> Self
便捷构造:相对 element 定位,无偏移
Sourcepub fn element_with_offset(
placement: AnchorPlacement,
gap: f32,
offset: Point,
) -> Self
pub fn element_with_offset( placement: AnchorPlacement, gap: f32, offset: Point, ) -> Self
便捷构造:相对 element 定位 + 偏移
Trait Implementations§
Source§impl Clone for OverlayAnchor
impl Clone for OverlayAnchor
impl Copy for OverlayAnchor
Auto Trait Implementations§
impl Forget for OverlayAnchor
impl Freeze for OverlayAnchor
impl Move for OverlayAnchor
impl RefUnwindSafe for OverlayAnchor
impl Send for OverlayAnchor
impl Sync for OverlayAnchor
impl Unpin for OverlayAnchor
impl UnsafeUnpin for OverlayAnchor
impl UnwindSafe for OverlayAnchor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more