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

Implement Drag-and-return & Circular drag #854

Merged

Conversation

feathecutie
Copy link
Contributor

@feathecutie feathecutie commented Apr 17, 2024

This implements drag-and-return and circular drag functions inspired by MessagEase.
These functions were essential to my workflow before I switched to thumb-key, so I figured I'd reimplement them here.

I'm sure some parts of the code could be improved, and I don't really like the implementation detail of having to pass the additional keys of the other keyboard layers to each key (as secondaryKey and tertiaryKey), but this seems like the easiest implementation with regard to the current architecture of thumb-key.

Drag-and-Return

thumb-key-drag-return

Lets you drag in direction of one the edges/corners of a key and back to the center in order to send the key on that edge/corner in the opposite case, so uppercase if the keyboard is currently lowercase, or lowercase if the keyboard is currently uppercase.
Note that this technically just switches between the main and shifted keyboard layout, so it will just send whatever is at the corresponding position of the equivalent keyboard.

Circular drag

thumb-key-circular-drag

Lets you drag in a circle starting and ending on the same key in order to send either the center key in the opposite case (main vs shifted layout), or send the number at the corresponding position of the key (numeric layout).

The circle detection code is completely improvised and could probably use some improvements, but in my testing, both drag-and-returns and circular drags were detected almost flawlessly.

@feathecutie feathecutie force-pushed the add-drag-return-and-circular-drag branch from 4f32d00 to 7dc2227 Compare April 17, 2024 11:41
@feathecutie
Copy link
Contributor Author

Nevermind, I just saw #362 and #317. I will leave this PR open for review/comment, but I understand that complex gestures are outside of the design of thumb-key.
In case this does not get implemented, I will probably just keep using a personal fork of thumb-key for now.

@mpsijm
Copy link
Contributor

mpsijm commented Apr 19, 2024

Thank you so much for implementing this! I've been missing this feature ever since I switched away from MessagEase, but hadn't found the time yet to implement it myself 😄

I have the feeling that the gestures are sometimes quite "strict". It happens to me quite often that a circle is interpreted as a drag-and-return, unless I try really hard to draw a perfect circle. Or, for the drag-and-return: if the return-part of my gesture overshoots the original key, the opposite letter gets typed (for example, when I want to type capital U, I get a lowercase d instead, because my return gesture moves too far downwards).

I'm not quite sure how to improve this, but if it helps, I can attach a debugger to my phone to try out some gestures, so we can link the recorded positions to expected results, to build a (unit-)test set 🙂

Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx! Everything works pretty well, except the circle-and-drag is very touchy.

Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do you want to try tweaking the circle-and-drag now, or do that later?

@feathecutie
Copy link
Contributor Author

LGTM. Do you want to try tweaking the circle-and-drag now, or do that later?

I don't really have time for it right now, so the earliest I'd commit something regarding that is tomorrow.

@dessalines
Copy link
Owner

Up to you, its no rush obvi.

@dessalines
Copy link
Owner

The DB stuff is good here, and we can always tweak later. Thx a ton for this!

@dessalines dessalines merged commit 0ab4b98 into dessalines:main Apr 24, 2024
1 check passed
glm4610 added a commit to glm4610/thumb-key that referenced this pull request Apr 25, 2024
The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (dessalines#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.
glm4610 added a commit to glm4610/thumb-key that referenced this pull request Apr 25, 2024
The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (dessalines#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.
dessalines pushed a commit that referenced this pull request Apr 25, 2024
The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.
@dessalines dessalines mentioned this pull request May 3, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants