Update hid_mouse_absolute.go

Eliminate adjustment of wheelY value. This is now done completely in mouseWheelHandler() in WebRTCVideo.tsx.
This commit is contained in:
rmschooley 2025-05-14 21:50:40 -05:00 committed by GitHub
parent 340babac24
commit 5411424d7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 15 deletions

View File

@ -107,24 +107,11 @@ func (u *UsbGadget) AbsMouseWheelReport(wheelY int8) error {
u.absMouseLock.Lock()
defer u.absMouseLock.Unlock()
// Accumulate the wheelY value
u.absMouseAccumulatedWheelY += float64(wheelY) / 8.0
// Only send a report if the accumulated value is significant
if abs(u.absMouseAccumulatedWheelY) < 1.0 {
return nil
}
scaledWheelY := int8(u.absMouseAccumulatedWheelY)
err := u.absMouseWriteHidFile([]byte{
2, // Report ID 2
byte(scaledWheelY), // Scaled Wheel Y (signed)
2, // Report ID 2
byte(wheelY), // Wheel Y (signed)
})
// Reset the accumulator, keeping any remainder
u.absMouseAccumulatedWheelY -= float64(scaledWheelY)
u.resetUserInputTime()
return err
}