From a271e08f16684f500eb5a80e4e3d1b1f4be312cb Mon Sep 17 00:00:00 2001 From: bi Date: Mon, 11 Jun 2018 15:14:37 +0300 Subject: [PATCH] Mutators GUI: fixed dissapearing mutators while trying to scroll --- .../mods/vmf/modules/ui/mutators/mutators_gui.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/vmf/scripts/mods/vmf/modules/ui/mutators/mutators_gui.lua b/vmf/scripts/mods/vmf/modules/ui/mutators/mutators_gui.lua index 7d9f250..f8ab8fd 100644 --- a/vmf/scripts/mods/vmf/modules/ui/mutators/mutators_gui.lua +++ b/vmf/scripts/mods/vmf/modules/ui/mutators/mutators_gui.lua @@ -335,12 +335,15 @@ end -- Reads scrollbar input and if it was changed, set current page according to the new scrollbar position local function update_scrollbar_input() - local scrollbar_info = _OTHER_WIDGETS.scrollbar.content.scroll_bar_info - local value = scrollbar_info.value - local old_value = scrollbar_info.old_value - if value ~= old_value then - _CURRENT_PAGE_NUMBER = math.clamp(math.ceil(value / (1 / _TOTAL_PAGES_NUMBER)), 1, _TOTAL_PAGES_NUMBER) - scrollbar_info.old_value = value + local scrollbar_widget_content = _OTHER_WIDGETS.scrollbar.content + if scrollbar_widget_content.visible then + local scrollbar_info = scrollbar_widget_content.scroll_bar_info + local value = scrollbar_info.value + local old_value = scrollbar_info.old_value + if value ~= old_value then + _CURRENT_PAGE_NUMBER = math.clamp(math.ceil(value / (1 / _TOTAL_PAGES_NUMBER)), 1, _TOTAL_PAGES_NUMBER) + scrollbar_info.old_value = value + end end end