Files
orcs-code/src/ink/events/click-event.ts
did:key:z6MkqDnb7Siv3Cwj7pGJq4T5EsUisECqR8KpnDLwcaZq5TPr d2542c9a62 asdf
Squash the current repository state back into one baseline commit while
preserving the README reframing and repository contents.

Constraint: User explicitly requested a single squashed commit with subject "asdf"
Confidence: high
Scope-risk: broad
Reversibility: clean
Directive: This commit intentionally rewrites published history; coordinate before future force-pushes
Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr
Not-tested: Fresh clone verification after push
2026-03-31 03:34:03 -07:00

39 lines
1.3 KiB
TypeScript

import { Event } from './event.js'
/**
* Mouse click event. Fired on left-button release without drag, only when
* mouse tracking is enabled (i.e. inside <AlternateScreen>).
*
* Bubbles from the deepest hit node up through parentNode. Call
* stopImmediatePropagation() to prevent ancestors' onClick from firing.
*/
export class ClickEvent extends Event {
/** 0-indexed screen column of the click */
readonly col: number
/** 0-indexed screen row of the click */
readonly row: number
/**
* Click column relative to the current handler's Box (col - box.x).
* Recomputed by dispatchClick before each handler fires, so an onClick
* on a container sees coords relative to that container, not to any
* child the click landed on.
*/
localCol = 0
/** Click row relative to the current handler's Box (row - box.y). */
localRow = 0
/**
* True if the clicked cell has no visible content (unwritten in the
* screen buffer — both packed words are 0). Handlers can check this to
* ignore clicks on blank space to the right of text, so accidental
* clicks on empty terminal space don't toggle state.
*/
readonly cellIsBlank: boolean
constructor(col: number, row: number, cellIsBlank: boolean) {
super()
this.col = col
this.row = row
this.cellIsBlank = cellIsBlank
}
}