mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/ui: bug fix: wrong mouse cursor movement calculation
Closes #2634
This commit is contained in:
parent
a56924b22f
commit
c00579509a
@ -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