Currently key swipes (not gesture typing) work only on space an delete keys. Space swipe can be customized somewhat, delete swipe can only be enabled/disabled. Changing the interface to a more flexible onKeySwipe(keyCode, direction) and onEndSwipe(keyCode) would allow simpler, more contained and also more customizable swipe actions:
Should be a step towards all issues labeled with key swipe
Could allow option to use Unexpected Keyboard style swipe instead of popup keys
Allows/simplifies adding step minium to the recently added numpad toggle space swipe (and removing related code from PointerTracker)
There are some things to consider though:
There is a single KeyboardActionListener, but mulitple PointerTrackers (to allow multi-touch). This means the KeyboardActionListener needs to be careful when keeping track of the swiping state. Maybe swipe actions will need to provide the pointer tracker id. Using multiple KeyboardActionListeners will not work here, because currently the KeyboardActionListenerImpl keeps track of the meta state (ctrl/alt/...), which should be global (though meta state could possible be handled in another place).
Maybe the KeyboardActionListener(Impl) could internally use multiple KeySwipeListeners (which would handle the key swipes, and nothing else), one per pointer tracker. Using such a KeySwipeListener with different implementations might also be useful for avoiding convoluted code when dealing with mutually exclusive key swipe styles.
The whole thing should also consider performance, as onKeySwipe can be called very often.
Currently key swipes (not gesture typing) work only on space an delete keys. Space swipe can be customized somewhat, delete swipe can only be enabled/disabled. Changing the interface to a more flexible
onKeySwipe(keyCode, direction)
andonEndSwipe(keyCode)
would allow simpler, more contained and also more customizable swipe actions:PointerTracker
)There are some things to consider though: There is a single
KeyboardActionListener
, but mulitplePointerTrackers
(to allow multi-touch). This means theKeyboardActionListener
needs to be careful when keeping track of the swiping state. Maybe swipe actions will need to provide the pointer tracker id. Using multipleKeyboardActionListener
s will not work here, because currently theKeyboardActionListenerImpl
keeps track of the meta state (ctrl/alt/...), which should be global (though meta state could possible be handled in another place). Maybe theKeyboardActionListener(Impl)
could internally use multiple KeySwipeListeners (which would handle the key swipes, and nothing else), one per pointer tracker. Using such aKeySwipeListener
with different implementations might also be useful for avoiding convoluted code when dealing with mutually exclusive key swipe styles. The whole thing should also consider performance, asonKeySwipe
can be called very often.