Prevent click 'transparency'

This commit is contained in:
Gabriel Tofvesson 2024-10-26 00:45:28 +02:00
parent 27d1bf5a31
commit f759cfe229
2 changed files with 16 additions and 9 deletions

View File

@ -110,16 +110,18 @@ function Padding:findById(id)
end
function Padding:handleEvent(evt)
if Element.handleEvent(self, evt) then
return true
end
local evtLocalCoords = Event.toElementLocalPosition(evt, self)
if Event.isClickEvent(evt) then
return Event.containsClick(self, evt) and self.element:handleEvent(evtLocalCoords)
else
return self.element:handleEvent(evtLocalCoords)
if Event.containsClick(self, evt) and self.element:handleEvent(evtLocalCoords) then
return true
end
else
if self.element:handleEvent(evtLocalCoords) then
return true
end
end
return Element.handleEvent(self, evt)
end
function Padding:_reload()

View File

@ -50,6 +50,10 @@ local function isLocked()
return fs.exists(LOCK_FILE)
end
local function ignoreClick()
return true
end
local function saveState(fname, ctrl)
local ser = ctrl:toSerializable()
local file = fs.open(fname, "w+")
@ -385,7 +389,8 @@ local PAGES = {
Padding:new{
id = GroupEntryID.PADDING,
bgColor = bgColor,
element = Text:new{ id = GroupEntryID.NAME, bgColor = bgColor, fgColor = fgColor }
element = Text:new{ id = GroupEntryID.NAME, bgColor = bgColor, fgColor = fgColor },
onClick = ignoreClick
},
Text:new{
id = GroupEntryID.COUNT,
@ -428,7 +433,7 @@ local PAGES = {
for i=1,#chars do
local key = chars:sub(i, i)
-- ((not backspace) and i == #keys and 0) or 1
table.insert(keys, Padding:new{ bgColor = KEYBOARD_BG_COLOR, right = 1, element = Text:new{
table.insert(keys, Padding:new{ onClick = ignoreClick, bgColor = KEYBOARD_BG_COLOR, right = 1, element = Text:new{
id = key,
text = key,
bgColor = KEYBOARD_KEY_COLOR,
@ -476,7 +481,7 @@ local PAGES = {
}
table.insert(keyboardLines.elements, 1, paddedFilterText)
local keyboardList = Padding:new{ bgColor = KEYBOARD_BG_COLOR, left = KEYBOARD_HPAD, right = KEYBOARD_HPAD, top = KEYBOARD_VPAD, bottom = KEYBOARD_VPAD, element = List:new{
local keyboardList = Padding:new{ onClick = ignoreClick, bgColor = KEYBOARD_BG_COLOR, left = KEYBOARD_HPAD, right = KEYBOARD_HPAD, top = KEYBOARD_VPAD, bottom = KEYBOARD_VPAD, element = List:new{
bgColor = KEYBOARD_BG_COLOR,
[Orientation:getId()] = Orientation.VERTICAL,
[Children:getId()] = keyboardLines.elements