Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/options/options.js
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | |||||
function getHotloadData() | function getHotloadData() | ||||
{ | { | ||||
return { | return { | ||||
"selectedCategory": g_SelectedCategory, | "selectedCategory": g_SelectedCategory, | ||||
"callback": g_HasCallback | "callback": g_HasCallback | ||||
}; | }; | ||||
} | } | ||||
/* | |||||
elexis: `selectNextTab` and using that name in all gui pages? | |||||
* Show next/previous panel. | |||||
* @param direction - 1/-1 forward, backward panel. | |||||
*/ | |||||
function selectNextTab(direction) | |||||
{ | |||||
g_SelectedCategory = (g_SelectedCategory + direction + Object.keys(g_Options).length) % | |||||
Object.keys(g_Options).length; | |||||
displayOptions(); | |||||
} | |||||
function placeTabButtons() | function placeTabButtons() | ||||
{ | { | ||||
for (let category in g_Options) | for (let category in g_Options) | ||||
{ | { | ||||
let button = Engine.GetGUIObjectByName("tabButton[" + category + "]"); | let button = Engine.GetGUIObjectByName("tabButton[" + category + "]"); | ||||
if (!button) | if (!button) | ||||
{ | { | ||||
warn("Too few tab-buttons!"); | warn("Too few tab-buttons!"); | ||||
break; | break; | ||||
} | } | ||||
button.onMouseWheelUp = () => selectNextTab(1); | |||||
button.onMouseWheelDown = () => selectNextTab(-1); | |||||
button.hidden = false; | button.hidden = false; | ||||
let size = button.size; | let size = button.size; | ||||
size.top = category * (g_TabButtonHeight + g_TabButtonDist); | size.top = category * (g_TabButtonHeight + g_TabButtonDist); | ||||
size.bottom = size.top + g_TabButtonHeight; | size.bottom = size.top + g_TabButtonHeight; | ||||
button.size = size; | button.size = size; | ||||
button.tooltip = g_Options[category].tooltip || ""; | button.tooltip = g_Options[category].tooltip || ""; | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
selectNextTab and using that name in all gui pages?