Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Touch weirdness bug - simple test script
Started by thomas6 Jan 07 2019 02:58 PM

- - - - -
2 replies to this topic
touch bug weirdness macbook simulator
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 976 posts
  • Corona SDK

Hi all,

 

I've found a weird touch bug in the simulator, at least on my MacBook Pro running OSX Mojave.

 

Try this simple script below in a clean main.lua and see if you have it too, if you like. The bug or weirdness is the following:

 

- click and hold the screen clicked

- each time a touch event is detected the counter adds 1

- I get about 160 "moved" touch events, just clicking in one spot and holding still. Then the counter sort of stops, unless I move my touch point around.

 

So in short, at first I get a steady stream of events for no particular reason, and then it trickles to a halt... Anybody else have this in their simulator?

 

I'm having extra issues with touch regarding rounding of the event.x and event.y values that I will share later in this post, but first I'd like to see if others can replicate this issue, or if it's specific to my setup. ( but I can already tell you that this rounding issue causes trouble with detection of touch move speed ).

 

thanks,

Thomas

local self = {}

self.touchCounter = 0
self.touchCounterText = display.newText(self.touchCounter, 200,200, system.nativeFont, 96)
self.touchCounterText.anchorX = 0

self.screenTouched = function(event)
	self.touchCounter = self.touchCounter + 1
	self.touchCounterText.text = self.touchCounter.." "..event.phase
end

Runtime:addEventListener("touch", self.screenTouched)


[TOPIC: post.html]
#2

Appletreeman

[GLOBAL: userInfoPane.html]
Appletreeman
  • Contributor

  • 444 posts
  • Corona SDK

I get a short burst (4 or 5) at first which then stops followed by an event each time I release the click, reclick etc.

If I move the mouse at all and then click then I get the short burst again.  This is obviously a lot less tha you are getting.

This is on OSX (10.13.6) with build 2018,3260

 

I personally would put this down to the sensitivity of whatever pointing device you are using (in your case I'm assuming it's the trackpad on your MBP).  My day job is spent as an Apple service technician and the diagnostic tests on the trackpads show how incredibly sensitive it is. The tiniest amount of movement (even if almost imperceptible to the eye) will register - hence all of your move events when you think you're holding still.  If you use a mouse rather than the trackpad and try again you'll likely see far less events registered.

 

Hope that helps.



[TOPIC: post.html]
#3

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 976 posts
  • Corona SDK

Good idea about the mouse - I'll try that later today. The problem with the simulator is that you get loads of "moved" events, but when you read out the event.x or event.y you get the same value as parameter, which leads to the following problem:

 

- the event phase says your touch point moved

- the event.x and event.y readout basically say that your touch point has not moved

 

I'm trying to read out the speed of movement (for a scrolling list), and this is giving me a big headache, because I always get my speed as "zero", because the simulator sort of say "Hey, the touch point moved, with a distance of zero!"




[topic_controls]
[/topic_controls]