Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/functions_utility.js
Show First 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
function hideRemaining(parentName, start = 0) | function hideRemaining(parentName, start = 0) | ||||
{ | { | ||||
let objects = Engine.GetGUIObjectByName(parentName).children; | let objects = Engine.GetGUIObjectByName(parentName).children; | ||||
for (let i = start; i < objects.length; ++i) | for (let i = start; i < objects.length; ++i) | ||||
objects[i].hidden = true; | objects[i].hidden = true; | ||||
} | } | ||||
/** | |||||
* Calculate next/previous index in an array, with wrapping on begin and end. | |||||
*/ | |||||
function nextIndex(index, indexArray, direction) | |||||
{ | |||||
return (index + direction + indexArray.length) % indexArray.length; | |||||
} | |||||
elexis: As in `return (index + direction + indexArray.length) % indexArray.length;` ?
I suspect this… | |||||
Not Done Inline ActionsNot convinced that this global function is worth it. We should unify the tabbing code eventually, still this, especially when also looking at the calls to this, looks ugly. elexis: Not convinced that this global function is worth it. We should unify the tabbing code… |
Wildfire Games · Phabricator
As in return (index + direction + indexArray.length) % indexArray.length; ?
I suspect this function can go too following this simplification and given that indexArray are global constants.