Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua
http://www.hammerspoon.org
MIT License
12.13k stars 586 forks source link

The information of the touchpad cannot accurately obtain the number of fingers #3683

Open Autumn-one opened 2 months ago

Autumn-one commented 2 months ago

I wrote the following code. Then, during the test, I found that when one finger was placed at the bottom of the touchpad and remained stationary, and another finger moved on the touchpad, the resulting touchpad information could only obtain the information of one finger


touchpadWatcher = hs.eventtap.new({hs.eventtap.event.types.gesture}, function(event)
    local touches = event:getTouches()
    local touchCount = #touches

    print("finger number: " .. touchCount)

    for i, touch in ipairs(touches) do
        print(string.format("finger %d: x = %f, y = %f", i, touch.normalizedPosition.x, touch.normalizedPosition.y))
    end
end)

touchpadWatcher:start()