Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fractional component for mouse/touch coordinates #1145

Open
W-Livi opened this issue Aug 8, 2022 · 3 comments
Open

fractional component for mouse/touch coordinates #1145

W-Livi opened this issue Aug 8, 2022 · 3 comments
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). area-Minecraft This affects CC's Minecraft-specific content. enhancement An extension of a feature or a new feature. feedback wanted Tell me what you want, what you really really want.

Comments

@W-Livi
Copy link

W-Livi commented Aug 8, 2022

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.

@W-Livi W-Livi added the enhancement An extension of a feature or a new feature. label Aug 8, 2022
@SquidDev SquidDev added feedback wanted Tell me what you want, what you really really want. area-Core This affects CC's core (the Lua runtime, APIs, computer internals). area-Minecraft This affects CC's Minecraft-specific content. labels Aug 8, 2022
@W-Livi
Copy link
Author

W-Livi commented Aug 17, 2022

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.

@walksanatora
Copy link

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

@walksanatora
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). area-Minecraft This affects CC's Minecraft-specific content. enhancement An extension of a feature or a new feature. feedback wanted Tell me what you want, what you really really want.
Projects
None yet
Development

No branches or pull requests

3 participants