Module mouse

Module mouse 

Source
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 canvas
  • TerminalMouseEvent - 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§

TerminalMouseEvent
Mouse event data with terminal cell coordinates.
TerminalMouseHandler
Handles mouse input events for a terminal grid.

Enums§

MouseEventType
Types of mouse events that can occur.

Type Aliases§

MouseEventCallback
Type alias for boxed mouse event callback functions.