Skip to content

Commit

Permalink
internal/uidriver/js: Bug fix: CursorPosition crashed before the main…
Browse files Browse the repository at this point in the history
… loop on browsers

Closes hajimehoshi#1559
  • Loading branch information
hajimehoshi committed Apr 17, 2021
1 parent 49c535f commit e8d9fcf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/uidriver/js/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type Input struct {
}

func (i *Input) CursorPosition() (x, y int) {
if i.ui.context == nil {
return 0, 0
}
xf, yf := i.ui.context.AdjustPosition(float64(i.cursorX), float64(i.cursorY))
return int(xf), int(yf)
}
Expand Down

0 comments on commit e8d9fcf

Please sign in to comment.