1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

Update setting page elements when possible

This commit is contained in:
uramer 2024-03-01 22:57:41 +01:00
parent 231b5753e4
commit 7a5493796f

View file

@ -329,10 +329,14 @@ local function renderPage(page, options)
bigSpacer, bigSpacer,
}, },
} }
if options.element then options.element:destroy() end
options.name = l10n(page.name) options.name = l10n(page.name)
options.element = ui.create(layout)
options.searchHints = generateSearchHints(page) options.searchHints = generateSearchHints(page)
if options.element then
options.element.layout = layout
options.element:update()
else
options.element = ui.create(layout)
end
end end
local function onSettingChanged(global) local function onSettingChanged(global)
@ -461,9 +465,6 @@ local function registerPage(options)
} }
pages[page.key] = page pages[page.key] = page
groups[page.key] = groups[page.key] or {} groups[page.key] = groups[page.key] or {}
if pageOptions[page.key] then
pageOptions[page.key].element:destroy()
end
pageOptions[page.key] = pageOptions[page.key] or {} pageOptions[page.key] = pageOptions[page.key] or {}
renderPage(page, pageOptions[page.key]) renderPage(page, pageOptions[page.key])
ui.registerSettingsPage(pageOptions[page.key]) ui.registerSettingsPage(pageOptions[page.key])