Asking for the canvas dragged event

Is there a way to make the first move on a canva more precise? I mean the "when.CanvasDraged" event. The position reading works only after moving by some number of pixels. Can this number be reduced?

joystick.aia (8.3 KB)

1 Like

Use a touch down event to start things off ?

I've tried it. I also tried a similar sprite event. It will catch the first pixel when touched. Then a dozen or so pixels are unreadable. Only after a dozen or so pixels are the coordinate values ‚Äč‚Äčreturned. With a large canvas, this is not a problem. But it uses small canvases with a working area of ‚Äč‚Äčabout 100x100px. And unfortunately, before it works, the value of the dragged pixels is quite large.

I don't know if there is a solution for this. I don't think so, but I've seen a lot of different interesting solutions here, that's why I asked.

I was thinking that you "post process" and fill in the gaps between the touch down pixel and the first drag pixel to your coordinates list...

Surprised you can achieve such precision on a 100x100 canvas with a finger.....

I'm making a joystick on a canvas. And the problem is that the joystick lever will only move after dragging a 15 pixels. The joystick is not too big to enter the interface I want to use it on. The size of the field for the joystick itself has no effect because the coordinates can be scaled accordingly. Well, unfortunately, before the event reads the pixels, the lever is already tilted forward and the returned values are already quite high. If I were to control the car with this joystick, it would start at high speed. It would be best if it moved smoothly from the beginning.

joystick.aia (8.3 KB)

I found a value corresponding to this.

  1. Maybe it would be a good idea to use this value for the canvas settings? Then, depending on what it is used for (not everyone uses clicks), we can change this value.

  2. Another solution would be to change the touch down event to be triggered on touch, and in addition to returning the touch value, it could return the current position after moving the finger regardless of the "TAP_THRESHOLD" value.

/**
* The number of pixels right, left, up, or down, a sequence of drags must
* move from the starting point to be considered a drag (instead of a
* touch).
*/
// This used to be 30 and people complained that they could not draw small circles.
// If the threshold is too small, then touches might be misinterpreted as drags,
// this might require more experimentation. We might also want to take screen resolution
// into account and/or try to make a more clever motion parser.
public static final int TAP_THRESHOLD = 15;

1 Like

I think option 1 would be acceptable so that it can be user-configured.

1 Like

Thank You. I added a problem on GitHub.