Documentation
¶
Overview ¶
Package mouse provides rectangular hit region tracking and double-click detection for TUI mouse support.
Index ¶
- type ActionType
- type ClickResult
- type Handler
- func (h *Handler) Clear()
- func (h *Handler) DragDelta(x, y int) (dx, dy int)
- func (h *Handler) DragRegion() string
- func (h *Handler) DragStartValue() int
- func (h *Handler) EndDrag()
- func (h *Handler) HandleClick(x, y int) ClickResult
- func (h *Handler) HandleMouse(msg tea.MouseMsg) MouseAction
- func (h *Handler) IsDragging() bool
- func (h *Handler) StartDrag(x, y int, regionID string, startValue int)
- type HitMap
- type MouseAction
- type Rect
- type Region
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType int
ActionType represents the type of mouse action detected.
const ( ActionNone ActionType = iota ActionClick ActionDoubleClick ActionScrollUp ActionScrollDown ActionScrollLeft // Shift+scroll up = scroll left ActionScrollRight // Shift+scroll down = scroll right ActionDrag ActionDragEnd ActionHover )
type ClickResult ¶
ClickResult represents the result of processing a click event.
type Handler ¶
type Handler struct {
HitMap *HitMap
// contains filtered or unexported fields
}
Handler combines a HitMap with mouse state tracking for drag and double-click detection.
func (*Handler) Clear ¶
func (h *Handler) Clear()
Clear resets the handler state and clears the hit map.
func (*Handler) DragRegion ¶
DragRegion returns the region ID being dragged.
func (*Handler) DragStartValue ¶
DragStartValue returns the initial value when the drag started.
func (*Handler) HandleClick ¶
func (h *Handler) HandleClick(x, y int) ClickResult
HandleClick processes a mouse click and returns the hit region. Tracks click timing for double-click detection.
func (*Handler) HandleMouse ¶
func (h *Handler) HandleMouse(msg tea.MouseMsg) MouseAction
HandleMouse is a convenience method for processing tea.MouseMsg events. Returns the action to take based on the mouse event.
func (*Handler) IsDragging ¶
IsDragging returns true if a drag operation is in progress.
type HitMap ¶
type HitMap struct {
// contains filtered or unexported fields
}
HitMap tracks hit regions for mouse click detection.
type MouseAction ¶
type MouseAction struct {
Type ActionType
Region *Region
X, Y int
Delta int // Scroll delta
DragDX int // Drag delta X
DragDY int // Drag delta Y
}
MouseAction represents a processed mouse event.