mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/uidriver/js: Bug fix: CursorPosition crashed before the main loop on browsers
Closes #1559
This commit is contained in:
parent
49c535fe84
commit
e8d9fcf220
@ -54,6 +54,9 @@ type Input struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *Input) CursorPosition() (x, y int) {
|
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))
|
xf, yf := i.ui.context.AdjustPosition(float64(i.cursorX), float64(i.cursorY))
|
||||||
return int(xf), int(yf)
|
return int(xf), int(yf)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user