Expand description
Mouse input handling for the beamterm terminal renderer.
This module provides mouse event handling infrastructure for the terminal, including coordinate conversion from pixel space to terminal grid space, text selection with automatic clipboard integration, and customizable event handling.
§Architecture
The mouse handling system consists of:
TerminalMouseHandler- Main event handler that attaches to a canvasTerminalMouseEvent- Mouse events translated to terminal coordinates- [
DefaultSelectionHandler] - Built-in text selection implementation - Internal state tracking for selection operations
§Example
use beamterm_renderer::{Terminal, SelectionMode};
// Enable default selection handler
let terminal = Terminal::builder("#canvas")
.default_mouse_input_handler(SelectionMode::Linear, true)
.build().unwrap();
// Or provide custom mouse handling
let terminal = Terminal::builder("#canvas")
.mouse_input_handler(|event, grid| {
println!("Mouse event at ({}, {})", event.col, event.row);
})
.build().unwrap();Structs§
- Terminal
Mouse Event - Mouse event data with terminal cell coordinates.
- Terminal
Mouse Handler - Handles mouse input events for a terminal grid.
Enums§
- Mouse
Event Type - Types of mouse events that can occur.
Type Aliases§
- Mouse
Event Callback - Type alias for boxed mouse event callback functions.