Some comments on mouse stuff

This commit is contained in:
Christian Rocha 2020-07-13 11:26:57 -04:00
parent 14a06b0896
commit 8025748828
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import "errors"
type MouseMsg MouseEvent type MouseMsg MouseEvent
// MouseEvent represents a mouse event, which could be a click, a scroll wheel
// movement, a cursor movement, or a combination.
type MouseEvent struct { type MouseEvent struct {
X int X int
Y int Y int
@ -12,6 +14,7 @@ type MouseEvent struct {
Ctrl bool Ctrl bool
} }
// String returns a string representation of a mouse event.
func (m MouseEvent) String() (s string) { func (m MouseEvent) String() (s string) {
if m.Ctrl { if m.Ctrl {
s += "ctrl+" s += "ctrl+"
@ -23,6 +26,7 @@ func (m MouseEvent) String() (s string) {
return s return s
} }
// MouseButton represents a mouse button event.
type MouseButton int type MouseButton int
const ( const (
@ -47,7 +51,7 @@ var mouseButtonNames = map[MouseButton]string{
MouseMotion: "motion", MouseMotion: "motion",
} }
// Parse an X10-encoded mouse event. The simplest kind. The last release of // Parse an X10-encoded mouse event; the simplest kind. The last release of
// X10 was December 1986, by the way. // X10 was December 1986, by the way.
// //
// X10 mouse events look like: // X10 mouse events look like: