pub struct DragPreview<'a> {
pub drag_state: &'a DragState,
pub config: DragPreviewConfig,
}Expand description
Overlay widget that renders a drag preview at the cursor position.
The preview renders either a custom widget (from DragState::preview)
or a text-based fallback from DragPayload::display_text.
§Rendering
- Pushes the configured opacity onto the buffer’s opacity stack.
- Optionally fills the background.
- Renders the custom preview widget or fallback text.
- Optionally draws a border.
- Pops the opacity.
§Invariants
- The preview is always clamped to the viewport bounds.
- Opacity is always restored (pop matches push) even if the area is empty.
- At
EssentialOnlydegradation or below, the preview is not rendered (it is decorative).
Fields§
§drag_state: &'a DragStateCurrent drag state (position, payload, optional custom preview).
config: DragPreviewConfigVisual configuration.
Implementations§
Source§impl<'a> DragPreview<'a>
impl<'a> DragPreview<'a>
Sourcepub fn with_config(drag_state: &'a DragState, config: DragPreviewConfig) -> Self
pub fn with_config(drag_state: &'a DragState, config: DragPreviewConfig) -> Self
Create a drag preview with custom configuration.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DragPreview<'a>
impl<'a> !RefUnwindSafe for DragPreview<'a>
impl<'a> !Send for DragPreview<'a>
impl<'a> !Sync for DragPreview<'a>
impl<'a> Unpin for DragPreview<'a>
impl<'a> !UnwindSafe for DragPreview<'a>
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