in reply to Event Recognition seems to be too slow
It is as if the mouse is too fast for the perl program.
If you start up MSPaint (or any other paint program probably), and doodle circles or spirals very quickly, you'll notice that instead of smooth arcs, they are made up of a series of short straight lines.
This is because you can move the mouse far faster than even a compiled C program can keep up with. What the authors of MSPaint do is to remember the last mouse position, and each time they get a new one, the join the old position to the new one with a straight line. At slow speeds, this gives the appearance of smooth arcs as the lines are very short, just 2 or 3 pixels. As the mouse speed increases, so the events are further and further apart, and the straight lines become more and more obvious.
You could do a similar thing within your program. Draw a line from the last position (set when drawing is initiated), to the current position; and then overwrite the last position with the current before leaving the bound sub in preparation for the next.
The are a couple of problems with doing this as your program is currently written.
You could simplify this by storing and labelling your grid using a 2D array/labels.
The solution is a lot more complex than what you currently have. Basically it involves building up the item line by line in an (normal perl) array and drawing it as a single Line item, adding each new set of coordinates as the mouse moves and deleting the old one.
In this way, once a line is drawn, it can be selected and manipulated--highlighted; color changed; deleted etc.--as a single item rather than a collection of pixels. But, its quite a lot of work.
Anyway, maybe this will inspire you to move forward with what you are doing.
|
|---|