类型 PointerEvent
API 文档由 Go 源码生成,内容为英文。
type PointerEvent struct {
Kind PointerEventKind
Button PointerButton
Modifiers Modifiers
X float32
Y float32
// ScreenX and ScreenY are the same point in screen coordinates: logical
// pixels from the top-left corner of the primary display, y down, the
// coordinates app.Window.Frame is in. A press that is held keeps reporting
// them when the pointer leaves the window, which is how a drag finds the
// window it ends over. Exit events carry none.
ScreenX, ScreenY float32
Viewport Size
Target ID
Captured bool
ClickCount int
}PointerEvent is delivered in logical window pixels. Target is the stable hit ID under the pointer, or the press target while Captured is true. Viewport is the current logical window size, allowing coordinate-driven controls to derive responsive geometry without mutating application state during Paint.
ClickCount numbers consecutive presses of one button close together in time and space, as the operating system defines a double click: 1 for a lone press, 2 for the second press of a double click, 3 for a triple click. Down and Up events carry the count of their press; other events carry 0.