Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,21 @@ type EventSource interface {
OnTextInput(func(text string))

// Mouse events
//
// All mouse/pointer coordinates (x, y) are in logical DIP (device-independent
// pixels), consistent with WindowProvider.Size(). Do NOT divide by ScaleFactor —
// the framework applies DPI scaling internally on all platforms.

// OnMouseMove registers a callback for mouse movement.
// x, y are in logical DIP relative to the window content area.
OnMouseMove(func(x, y float64))

// OnMousePress registers a callback for mouse button press.
// x, y are in logical DIP relative to the window content area.
OnMousePress(func(button MouseButton, x, y float64))

// OnMouseRelease registers a callback for mouse button release.
// x, y are in logical DIP relative to the window content area.
OnMouseRelease(func(button MouseButton, x, y float64))

// OnScroll registers a callback for scroll wheel events.
Expand Down
12 changes: 8 additions & 4 deletions pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ type PointerEvent struct {
// The ID remains constant from PointerDown through PointerUp/PointerCancel.
PointerID int

// X is the horizontal position relative to the window content area.
// Uses logical pixels (CSS pixels equivalent).
// X is the horizontal position relative to the window content area, in
// logical DIP (device-independent pixels). Consistent with App.Size() on
// all platforms. Do NOT divide by ScaleFactor — DPI scaling is applied
// internally by the framework.
X float64

// Y is the vertical position relative to the window content area.
// Uses logical pixels (CSS pixels equivalent).
// Y is the vertical position relative to the window content area, in
// logical DIP (device-independent pixels). Consistent with App.Size() on
// all platforms. Do NOT divide by ScaleFactor — DPI scaling is applied
// internally by the framework.
Y float64

// Pressure indicates the normalized pressure of the pointer input.
Expand Down
8 changes: 4 additions & 4 deletions scroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ func (p ScrollPhase) String() string {
// }
// })
type ScrollEvent struct {
// X is the pointer horizontal position at the time of scrolling.
// Uses logical pixels relative to the window content area.
// X is the pointer horizontal position at the time of scrolling, in
// logical DIP (device-independent pixels). Consistent with App.Size().
X float64

// Y is the pointer vertical position at the time of scrolling.
// Uses logical pixels relative to the window content area.
// Y is the pointer vertical position at the time of scrolling, in
// logical DIP (device-independent pixels). Consistent with App.Size().
Y float64

// DeltaX is the horizontal scroll amount.
Expand Down
Loading