mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-19 02:16:43 +00:00
minor bug fixes
This commit is contained in:
@@ -123,6 +123,25 @@ local function registerLayoutEvents (self)
|
||||
end
|
||||
end)
|
||||
|
||||
menuLayout:onPress(function (event)
|
||||
for widget in event.target:eachAncestor(true) do
|
||||
if widget.type == 'menu.item' and #widget.items == 0 then
|
||||
menuLayout:hide()
|
||||
deactivateSiblings(self.rootMenu[1])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
menuLayout:onPressEnd(function (event)
|
||||
for widget in event.target:eachAncestor(true) do
|
||||
if widget.type == 'menu.item' and #widget.items == 0
|
||||
and event.target ~= event.origin then
|
||||
widget:bubbleEvent('Press', event)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
menuLayout:onEnter(activate)
|
||||
menuLayout:onPressEnter(activate)
|
||||
end
|
||||
|
||||
@@ -200,6 +200,20 @@ return function (self)
|
||||
end)
|
||||
|
||||
self:onKeyPress(function (event)
|
||||
|
||||
-- ignore tabs (keyboard navigation)
|
||||
if event.key == 'tab' then
|
||||
return
|
||||
end
|
||||
|
||||
-- focus next widget on enter (keyboard navigation)
|
||||
if event.key == 'return' then
|
||||
self.layout:focusNextWidget()
|
||||
-- if the next widget is a button, allow the event to propagate
|
||||
-- so that the button is pressed (TODO: is this a good idea?)
|
||||
return self.layout.focusedWidget.type ~= 'button' or nil
|
||||
end
|
||||
|
||||
if event.key == 'backspace' then
|
||||
|
||||
if not deleteRange(self) then
|
||||
|
||||
Reference in New Issue
Block a user