Getting fractional event x/y values in touch listener

On an iPad, try this classic example of how to drag an object across the screen:

https://coronalabs.com/blog/2011/09/24/tutorial-how-to-drag-objects/

using the “modern ultimate config file” with the 320/480 settings:

https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

Since the config settings will cause Corona to scale up all display objects 4 times (using the @4x versions of images), the “content pixels” and “actual pixels on the device” will differ. For example, a newLine defined as 1 px wide (content pixels) will be displayed as 4 pixels wide (actual pixels on the device). This also means that you have to drag your finger 4 actual pixels on the device before the position changes by 1 content pixel. This  creates an “unsmooth” effect since the dragged image jumps by 4 pixels at a time.

By printing event.x to the console, I have seen that the “moved” phase of the listener actually gets triggered although event.x remains the same (when dragging really slowly just a tiny amount). This means that the listener somehow hears the move although nothing has actually moved on the screen. I assume that the problem could be resolved if x and y coordinates could be read with decimals.

How can I get the listener to see the fractional changes in the x or y when an object is dragged?

Not as far as I know. I raised this point sometime last year:

https://forums.coronalabs.com/topic/47296-is-it-possible-to-get-fractional-xy-positions-from-touch-events/

In the end, our solution was to set the default config size to the higher devices and scale down, rather than the other way around.

content = { width = 1600, height = 2560, scale = "letterbox", imageSuffix = { [""] = 1.0, ["@2x"] = 0.5, ["@4x"] = 0.25, }, },

@Alan: the problem is that I am almost finished with my app and I don’t want to re-paint all my images. Correct me if I’m wrong, but if you change the width and height to values that are not multiples of 320/480, the “displayed size” of the image relative to the screen size changes (right?). In other words: a box that took up exactly half the screen width with the 320/480 setting would no longer do so in your setting above.

Anyway, I consider this just a workaround, the more elegant solution would be to enable the listeners to see fractional changes.

Can anyone from the Corona staff weigh in here?

Not as far as I know. I raised this point sometime last year:

https://forums.coronalabs.com/topic/47296-is-it-possible-to-get-fractional-xy-positions-from-touch-events/

In the end, our solution was to set the default config size to the higher devices and scale down, rather than the other way around.

content = { width = 1600, height = 2560, scale = "letterbox", imageSuffix = { [""] = 1.0, ["@2x"] = 0.5, ["@4x"] = 0.25, }, },

@Alan: the problem is that I am almost finished with my app and I don’t want to re-paint all my images. Correct me if I’m wrong, but if you change the width and height to values that are not multiples of 320/480, the “displayed size” of the image relative to the screen size changes (right?). In other words: a box that took up exactly half the screen width with the 320/480 setting would no longer do so in your setting above.

Anyway, I consider this just a workaround, the more elegant solution would be to enable the listeners to see fractional changes.

Can anyone from the Corona staff weigh in here?