mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: bug fix: wrong mouse cursor movement calculation
Closes #2634
This commit is contained in:
parent
3f2195178f
commit
6f3ef30180
@ -115,7 +115,9 @@ func (u *userInterfaceImpl) setMouseCursorFromEvent(e js.Value) {
|
||||
if u.cursorMode == CursorModeCaptured {
|
||||
x, y := e.Get("clientX").Int(), e.Get("clientY").Int()
|
||||
u.origCursorX, u.origCursorY = x, y
|
||||
dx, dy := u.context.clientPositionToLogicalPosition(e.Get("movementX").Float(), e.Get("movementY").Float(), u.DeviceScaleFactor())
|
||||
s := u.DeviceScaleFactor()
|
||||
dx, dy := e.Get("movementX").Float()/s, e.Get("movementY").Float()/s
|
||||
// TODO: Keep float64 values.
|
||||
u.inputState.CursorX += int(dx)
|
||||
u.inputState.CursorY += int(dy)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user