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

[UX] VirtualKeyPopup: respond to hold & pan release #4887

Merged
merged 3 commits into from Apr 9, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -131,6 +131,18 @@ function VirtualKey:init()
range = self.dimen,
},
},
HoldReleaseKey = {
GestureRange:new{
ges = "hold_release",
range = self.dimen,
},
},
PanReleaseKey = {
GestureRange:new{
ges = "pan_release",
range = self.dimen,
},
},
SwipeKey = {
GestureRange:new{
ges = "swipe",
@@ -219,6 +231,9 @@ function VirtualKey:onSwipeKey(arg, ges)
return true
end

VirtualKey.onHoldReleaseKey = VirtualKey.onTapSelect
VirtualKey.onPanReleaseKey = VirtualKey.onTapSelect

function VirtualKey:invert(invert, hold)
if invert then
self[1].inner_bordersize = self.focused_bordersize
@@ -298,11 +313,21 @@ function VirtualKeyPopup:init()
key_chars = key_chars,
width = parent_key.width,
height = parent_key.height,
hold_callback = nil,
}
virtual_key.hold_callback = nil

if v == key_char_orig then
virtual_key[1].background = Blitbuffer.COLOR_LIGHT_GRAY

-- restore ability to hold/pan release on central key after opening popup
virtual_key._keyOrigHoldPanHandler = function()
virtual_key.onHoldReleaseKey = virtual_key._onHoldReleaseKey
virtual_key.onPanReleaseKey = virtual_key._onPanReleaseKey
end
virtual_key._onHoldReleaseKey = virtual_key.onHoldReleaseKey
virtual_key.onHoldReleaseKey = virtual_key._keyOrigHoldPanHandler
virtual_key._onPanReleaseKey = virtual_key.onPanReleaseKey
virtual_key.onPanReleaseKey = virtual_key._keyOrigHoldPanHandler

This comment has been minimized.

Copy link
@poire-z

poire-z Apr 9, 2019

Contributor

What does all that allow?
Not really understanding - looks to me you hold on the original keyboard key - and this virtual key (even with the same letter) is another VirtualKey object, so when you release that second one, the first one should still work. (?)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 9, 2019

Author Member

This doesn't allow anything. ;-) It restricts the central key in the popup from responding as if there were an intentional hold release after opening. But after opening, it felt odd when it didn't respond like any other key.

end

table.insert(group, virtual_key)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.