drag event

@nugett,

it was not the first public commit - there were a handful before this one, but thanks! However, I’m looking to make *another* one because it turns out the drag event code I pilfered does not play nice with content scaled devices - so basically if you define a “content” size in config.lua, the delta values it returns do not properly correspond to display coordinates. Hope to fix it soon!  :blink:

Drag event?

local function drag() print("this will print a lot") end Runtime:addEventListener("drag",drag)

Is this actually a feature? If it’s not in the docs it must either be WIP or abandoned?

That’s what I said.

I’m on a Mac and it works in the Corona sim.

I can only assume it’s an abandoned feature.

Passes this to the event parameter:

y 111.5022277832 x 183.18222045898 time 4123.057 name drag yDelta -64 xDelta 132

How did you come across it?

I’ve never heard of a drag event and it is not listed in the API event list, so I would assume it is a dead feature.

PS - Yes, I know we’re all saying ‘it’s not in the docs’, but I don’t think it hurts to say it a few times. :slight_smile:

Just for fun I went through old docs, all the way back to ‘2013.1218’ and did not find a drag event.

PS - I’m one of those weirdos who likes do regularly download the API docs zip, just in case.

I have a settings module which can dispatch any setting via Runtime when it changes. I happen to have a setting called ‘drag’ but found that listening for that event (the event name is the same as the setting name) I ended up with tonnes of events being generated. Took a while to figure that out.

Well now I just find myself wishing that the ‘xDelta’ and ‘yDelta’ values were automatically supplied in touch events.  :blink:

Yep, those are nice to have. #featurerequest

@schroederapps what are xDelta and yDelta?

@agramonte - just the difference between event.x and event.xStart (and y & yStart) - easily calcuable, but I like that they included it in drag events and think it’d be convenient to include it in touch events also. I may try to add it in myself now that Corona is open source. Seems like a low-pressure place to start learning how to edit Corona’s source code.

@schroederapps exactly what I was thinking. You just have to copy and paste the code from the other location and test.

Made a pull request into the source to add xDelta and yDelta properties to touch events. Hopefully it gets approved & merged and we’ll have those values in all our touch events moving forward!

Gotta love how we’re able to make these little usability tweaks ourselves now that Corona is open source! :slight_smile:

https://github.com/coronalabs/corona/pull/17

Last update: the pull request got approved and as of daily build 2019.3466 touch events xDelta and yDelta properties! :) 

https://developer.coronalabs.com/release/2019/3466/

I’m unaware of any “drag” event that we support. Most people drag with the “touch” event.

And thank you for your updates @schroederapps.  Make sure to hit the link at the bottom of the touch event docs so I can update the docs with the new event members.

Rob

@schroederapps Thank you - a lot of devs will appreciate this, me especially!

@rob I didn’t expect it either, but it’s definitely there. Have you tried it yourself?

@horacebury, no I haven’t tried it since I didn’t know it was there. Since it’s undocumented, I’m running on the assumption you stumbled upon something an engineer was playing with years ago that got into the code and got forgotten.

Rob

back in 2010…

-Walter, do you remember that bezier curves script I was writing?

-Give me a sec, Carlos, I’m adding a drag event…

-F* the drag, I’m talking about a revolution here! Let me tell you…

Is this the first public commit?? This is history! Congrats! :slight_smile: