From e5662a876605a085771457187f6439815ab6ba47 Mon Sep 17 00:00:00 2001 From: Azumgi Date: Fri, 26 Jan 2018 17:52:53 +0300 Subject: [PATCH] Added basic tooltips support to options widgets (options menu) --- .../mods/vmf/modules/vmf_options_view.lua | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/vmf_source/scripts/mods/vmf/modules/vmf_options_view.lua b/vmf_source/scripts/mods/vmf/modules/vmf_options_view.lua index 49e2c64..d7a48c1 100644 --- a/vmf_source/scripts/mods/vmf/modules/vmf_options_view.lua +++ b/vmf_source/scripts/mods/vmf/modules/vmf_options_view.lua @@ -429,6 +429,16 @@ local function create_header_widget(widget_definition, scenegraph_id) content_id = "highlight_hotspot" }, + -- TOOLTIP + { + pass_type = "tooltip_text", + + text_id = "tooltip_text", + style_id = "tooltip_text", + content_check_function = function (content) + return content.tooltip_text and content.highlight_hotspot.is_hover + end + }, -- PROCESSING -- DEBUG { @@ -472,6 +482,7 @@ local function create_header_widget(widget_definition, scenegraph_id) highlight_hotspot = {}, text = widget_definition.readable_mod_name, + tooltip_text = widget_definition.tooltip, mod_name = widget_definition.mod_name, widget_type = widget_definition.widget_type, @@ -547,6 +558,22 @@ local function create_header_widget(widget_definition, scenegraph_id) offset = {widget_size[1] - 205, offset_y, 0} }, + -- TOOLTIP + + tooltip_text = { + font_type = "hell_shark", + font_size = 24, + horizontal_alignment = "left", + vertical_alignment = "top", + cursor_side = "left", + max_width = 600, + cursor_offset = {-10, -27}, + line_colors = { + Colors.get_color_table_with_alpha("cheeseburger", 255), + Colors.get_color_table_with_alpha("white", 255) + } + }, + -- DEBUG debug_middle_line = { @@ -633,6 +660,16 @@ local function create_checkbox_widget(widget_definition, scenegraph_id) content_id = "highlight_hotspot" }, + -- TOOLTIP + { + pass_type = "tooltip_text", + + text_id = "tooltip_text", + style_id = "tooltip_text", + content_check_function = function (content) + return content.tooltip_text and content.highlight_hotspot.is_hover + end + }, -- PROCESSING { pass_type = "local_offset", @@ -704,6 +741,7 @@ local function create_checkbox_widget(widget_definition, scenegraph_id) highlight_hotspot = {}, text = widget_definition.text, + tooltip_text = widget_definition.tooltip, mod_name = widget_definition.mod_name, setting_name = widget_definition.setting_name, @@ -747,6 +785,22 @@ local function create_checkbox_widget(widget_definition, scenegraph_id) offset = {widget_size[1] - 180, offset_y + 10, 0}, }, + -- TOOLTIP + + tooltip_text = { + font_type = "hell_shark", + font_size = 24, + horizontal_alignment = "left", + vertical_alignment = "top", + cursor_side = "left", + max_width = 600, + cursor_offset = {-10, -27}, + line_colors = { + Colors.get_color_table_with_alpha("cheeseburger", 255), + Colors.get_color_table_with_alpha("white", 255) + } + }, + -- DEBUG debug_middle_line = { @@ -873,6 +927,16 @@ local function create_stepper_widget(widget_definition, scenegraph_id) style_id = "right_arrow_hotspot", content_id = "right_arrow_hotspot" }, + -- TOOLTIP + { + pass_type = "tooltip_text", + + text_id = "tooltip_text", + style_id = "tooltip_text", + content_check_function = function (content) + return content.tooltip_text and content.highlight_hotspot.is_hover + end + }, -- PROCESSING { pass_type = "local_offset", @@ -954,6 +1018,7 @@ local function create_stepper_widget(widget_definition, scenegraph_id) right_arrow_hotspot = {}, text = widget_definition.text, + tooltip_text = widget_definition.tooltip, mod_name = widget_definition.mod_name, setting_name = widget_definition.setting_name, @@ -1027,6 +1092,22 @@ local function create_stepper_widget(widget_definition, scenegraph_id) offset = {widget_size[1] - 60, offset_y + 7, 0} }, + -- TOOLTIP + + tooltip_text = { + font_type = "hell_shark", + font_size = 24, + horizontal_alignment = "left", + vertical_alignment = "top", + cursor_side = "left", + max_width = 600, + cursor_offset = {-10, -27}, + line_colors = { + Colors.get_color_table_with_alpha("cheeseburger", 255), + Colors.get_color_table_with_alpha("white", 255) + } + }, + -- DEBUG debug_middle_line = {