— Console Log ----
Jul 24 04:08:15.803 [Device] eventX: 156.5 eventY: 157
Jul 24 04:08:15.822 [Device] eventX: 145.5 eventY: 148.5
Jul 24 04:08:15.839 [Device] eventX: 133 eventY: 140
Jul 24 04:08:15.855 [Device] eventX: 122 eventY: 132.5
Jul 24 04:08:15.889 [Device] eventX: 443 eventY: 270.5 <— unexpected jump across the screen
— Console Log —
Jul 24 04:26:50.692 [Device] eventX: 85 eventY: 85
Jul 24 04:26:50.727 [Device] eventX: 96 eventY: 94
Jul 24 04:26:50.759 [Device] eventX: 104.5 eventY: 103
Jul 24 04:26:50.793 [Device] eventX: 112 eventY: 110
Jul 24 04:26:51.064 [Device] eventX: 442.5 eventY: 267 < —
Thought it was a bug in my game, but I broke it down to the bare essentials in a new standalone project and still get this wonky jump when testing on my phone ( iPhone 5s )
So now I’m not sure if it’s a bug in Corona, or if my phone is getting wonky. I don’t have a secondary device to test with and I haven’t noticed the issue in the simulator. =/
Edit: Forgot the code snippet I’m using. I’m able to reproduce it with this… I usually start to drag to the lower right hand corner when it happens. It doesn’t happen every single time… just randomly after repeating it several times.
local box = display.newRect( 10, 10, 50, 50 ) box.anchorX = 0 box.anchorY = 0 local function touchHandler( event ) if( event.phase == "began") then display:getCurrentStage():setFocus( event.target ) event.target.isFocus = true event.target.touchOffsetX = event.x - event.target.x event.target.touchOffsetY = event.y - event.target.y elseif( event.target.isFocus ) then if( event.phase == "moved" ) then print( "eventX: " .. event.x .. " eventY: " .. event.y ) event.target.x = event.x - event.target.touchOffsetX event.target.y = event.y - event.target.touchOffsetY elseif( event.phase == "ended" or event.phase == "cancelled" ) then display.getCurrentStage():setFocus( nil ) event.target.isFocus = nil end end return true end box:addEventListener( "touch", touchHandler )
Edit 2: I don’t think I was clear that it’s the event position that i’m receiving from corona that makes the jump, not the calculation i’m doing…(well, I mean, that jumps too, but only because what I am getting from the touch event) Hence why I think it’s a bug or my phone is b0rked.
Also, video example here:
[media]https://www.youtube.com/watch?v=BcYc7WDRlY0[/media]
