CC: Tweaked

CC: Tweaked

42M Downloads

fractional component for mouse/touch coordinates

W-Livi opened this issue ยท 3 comments

commented

for Events such as mouse_click, mouse_drag and monitor_touch, where the coordinates being reported are currently quantized to integers on the terminal's character grid, I would like to see some additional parameters from which I can derive a sub-character position for the event (i.e. the position within the character-cell where the event occurred.)

I'm working on some software which uses the block mosaic characters (0x80 to 0x9F) to create blittable characters from blocks of 2*3 logical pixels. As I'm working with elements that are smaller than a character, I find it would be helpful to have a little more resolution than the existing character-based mouse handling is designed for.

Additional mouse resolution could also be helpful for software which may want to track mouse movement for tasks that don't map directly to screen coordinates, such as rotation of an object or viewport in a 3d application.

I wouldn't wish to break compatibility with the myriad of programs which assume the existing coordinates to be integers, thus I suggest that the added resolution come from new, additional parameters of the events; tacked on at the end where most software can simply ignore them.

commented

Of course, merely adding fractional coordinates would leave things sorta half-done for mouse_drag, as I believe the event only fires when dragging across character boundaries, so movement within a character would go unreported.

If we were to expand mouse handling to sub-character resolutions, it may be worth considering a means for a program to request added resolution for mouse_drag events. Perhaps some function that could be called to specify a number of intra-character subdivisions? So for working with the block mosaic characters, I could call something like setMouseDragResolution(2,3) to signal the system that I want two events per character horizontally, and three events vertically.

commented

For me the naive solution would be smth like
os.enableHighPrescisionMouse(bool)
That would enable the script to enable the use of decimals on os.pullEvent for mouse events

commented

the other option is _hires which has the high resolution movements
downside: you are broadcasting two events for 1 action