I’m on a windows 10 computer, using build 2020.3635.
With just the below in main.lua, if I hold down the primary button on the touch pad I get the “began” event as expect. If I then press and hold any key I get ended, began, ended. The first ended and began are immediate, with the next ended coming after a moment. With the release of the key there is another began event. I imagine this is an issue with the laptop/windows, but I really have no idea what’s going on. Would appreciate any advice, thanks.
That listener is insufficient to debug what is happening.
Try this, so you can see exactly what is happening:
local function onTouch(event)
for k,v in pairs(event) do
print( "onTouch()", k, " == ", v )
end
print ("-------------------\n")
end
Runtime:addEventListener( "touch", onTouch )
Well, the good news is that this doesn’t happen when I use the mouse. Perhaps an issue with the touchpad, which has always been troublesome ( jumping around when you tap, for example).
Hi. Sorry if I’m a bit slow here, but what do you mean exactly by
“Primary button on touch pad”.
Are you using a laptop that has buttons below/above the track pad?
If I’m close to right, can you tell us the model of laptop you’re using?
What you’re saying is quite confusing because the buttons should not produce touch events.
When I hear the word button, I think “keys on your keyboard, buttons on a controller, and buttons on a mouse”. The prior two produce key events, not touch events.
Try adding this code too and see what it prints:
local function onKey(event)
for k,v in pairs(event) do
print( "onKey()", k, " == ", v )
end
print ("-------------------\n")
end
Runtime:addEventListener( "key", onKey )
local function onMouseEvent( event )
if event.type == "down" then
if event.isPrimaryButtonDown then
print( "Left mouse button clicked." )
elseif event.isSecondaryButtonDown then
print( "Right mouse button clicked." )
end
end
end
Runtime:addEventListener( "mouse", onMouseEvent )
If you’re talking about the equivalent of the left-mouse button, then clicking that while running the simulator and while your pointer is over the simulator window is the same as touching the screen.
Apologies if I’m confused, but that sounds like what you’re saying.
If there’s any slowness, it’s probably me. It usually is.
I have a HP pavilion 15-aw002na, the track pad of which is just one flat surface (like the one below), with left- and right-click concealed underneath. By “primary button”, I meant left-click.