Skip to main content

Module mouse_pointer

Module mouse_pointer 

Source
Expand description

Mouse Pointer Indicator Widget

A visual indicator that displays at the current mouse cursor position. Useful for debugging mouse interactions or providing visual feedback.

§Example

use ratatui_interact::components::{MousePointer, MousePointerState, MousePointerStyle};
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;

// Create state (disabled by default)
let mut state = MousePointerState::default();

// Enable and update position from mouse event
state.set_enabled(true);
state.update_position(10, 5);

// Create widget with custom style
let pointer = MousePointer::new(&state)
    .style(MousePointerStyle::crosshair());

// Render to buffer (usually called last to be on top)
let mut buf = Buffer::empty(Rect::new(0, 0, 80, 24));
pointer.render(&mut buf);

Structs§

MousePointer
A widget that renders a mouse pointer indicator.
MousePointerState
State for the mouse pointer indicator.
MousePointerStyle
Style configuration for the mouse pointer indicator.