agwells / dotdash-keyboard-android

The world's most popular open source Morse code keyboard for Android! (probably)
GNU General Public License v3.0
32 stars 4 forks source link

Moving arround in text better #30

Open mrcrsr opened 1 year ago

mrcrsr commented 1 year ago

As promised, here is my next topic.

Moving arround in text by trying to touch the correct place is really hard, in EVERY keyboard. AnySoftKeyboard offers these nice buttons for moving the cursor back and forth. Adding two additional buttons will definitely hit the minimalism in dot dash keyboard. Maybe horizontal swipe gestures or something similar could be used for that.

mentalisttraceur commented 10 months ago

Lots of keyboards support sliding/swiping left/right from the space bar for continuous left/right cursor motions by character (and some also support up/down).

The trick is feedback and ability to reverse - a tiny tactile vibrate as the cursor moves over each character for example, and if you went too far you just start sliding the other way without lifting finger.

Another possible inspiration: circles. Touch finger to keyboard touch area and start spinning - maybe each 30 or 15 degrees is a character of cursor movement - this allows naturally going wider to big slow arcs for more precision, and tight small fast circles for quick traverse.

mrcrsr commented 10 months ago

Swiping left and right from the space bar would be really great and indeed better than additional buttons.

I am not a GUI nor an Android developer, so I don't know, how swipe gestures are realized. But I assume, that circles are much heavier to implement than simple and straight horizontal lines, where you only have to track one coordinate axis.

mentalisttraceur commented 10 months ago

@mrcrsr You can checkout 8vim "keyboard" (open source) for an example of circle motions. (It's a "keyboard" whose whole Thing is spinning your finger around a circle.)

But actually, off the top of my head, you don't actually have to "understand" circles at all - you just have to split up the touch area into pie slices - once a touch event starts, we can just watch if the coordinates are changing enough to count as a motion or not, and once they count as a motion, just start checking at every time interval which slice the touch is in. When the slice changes, you know the user has moved enough degrees.

If you want to make sure you don't count motions that are too straight to look like circles, just check for a 2nd order delta - between two checks of the position, you have a diff to the x coordinate and to the y coordinate - between three checks of the position, you have two diffs to the x and two diffs to the y - you can check that both are changing more than some tiny threshold, and then you know the motion is more curvy than straight.