1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 05:39:42 +00:00

Merge branch 'settings_input' into 'master'

More responsive renderers for input events (#6827)

Closes #6827

See merge request OpenMW/openmw!2093
This commit is contained in:
psi29a 2022-07-09 17:32:36 +00:00
commit e70d2be1ee
2 changed files with 14 additions and 13 deletions

View file

@ -150,6 +150,13 @@ local function renderGroup(group, global)
local resetButtonLayout = {
template = I.MWUI.templates.box,
events = {
mouseClick = async:callback(function()
for _, setting in pairs(group.settings) do
setSettingValue(global, group.key, setting.key, setting.default)
end
end),
},
content = ui.content {
{
template = I.MWUI.templates.padding,
@ -159,13 +166,6 @@ local function renderGroup(group, global)
props = {
text = interfaceL10n('Reset')
},
events = {
mouseClick = async:callback(function()
for _, setting in pairs(group.settings) do
setSettingValue(global, group.key, setting.key, setting.default)
end
end),
},
},
},
},

View file

@ -73,7 +73,7 @@ return function(registerRenderer)
registerRenderer('checkbox', function(value, set, argument)
argument = applyDefaults(argument, defaultArgument)
local l10n = core.l10n(argument.l10n)
return disable(argument.disabled, paddedBox {
local box = paddedBox {
template = I.MWUI.templates.padding,
content = ui.content {
{
@ -81,12 +81,13 @@ return function(registerRenderer)
props = {
text = l10n(value and argument.trueLabel or argument.falseLabel)
},
events = {
mouseClick = async:callback(function() set(not value) end),
},
},
}
})
},
}
box.events = {
mouseClick = async:callback(function() set(not value) end)
}
return disable(argument.disabled, box)
end)
end