forked from ultraworkers/claw-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclick-event.ts
More file actions
38 lines (36 loc) · 1.3 KB
/
Copy pathclick-event.ts
File metadata and controls
38 lines (36 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}
}