internal/ui: bug fix: wrong mouse cursor movement calculation

Closes #2634
This commit is contained in:
Hajime Hoshi 2023-04-10 15:25:02 +09:00
parent a56924b22f
commit c00579509a

View File

@ -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