class Opal::Input::MouseMap

Overview

Declarative mouse event routing, click handling, and hit-testing DSL.

Defined in:

opal/input/mouse_map.cr

Instance Method Summary

Instance Method Detail

def handle(event : Terminal::MouseEvent) : Bool #

Dispatches a MouseEvent to all matching handlers. Returns true if at least one handler processed the event, false otherwise.


[View source]
def on(action : Symbol, button : Terminal::MouseButton | Nil = nil, &block : Terminal::MouseEvent -> Nil) : self #

Registers a click handler with optional button constraint (:left, :middle, :right)


[View source]
def on_click(button : Terminal::MouseButton | Nil = nil, &block : Terminal::MouseEvent -> Nil) : self #

[View source]
def on_scroll_down(&block : Terminal::MouseEvent -> Nil) : self #

[View source]
def on_scroll_up(&block : Terminal::MouseEvent -> Nil) : self #

[View source]
def zone(x : Range(Int32, Int32), y : Range(Int32, Int32), &block : Terminal::MouseEvent -> Nil) : self #

Registers a bounding-box hit test zone (e.g. for buttons, tabs, or cards)


[View source]