Insert missing ooba samplers
This commit is contained in:
parent
8bd1c88d15
commit
b1bb41313f
|
@ -805,6 +805,21 @@ function showTypeSpecificControls(type) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts missing items from the source array into the target array.
|
||||
* @param {any[]} source - Source array
|
||||
* @param {any[]} target - Target array
|
||||
* @returns {void}
|
||||
*/
|
||||
function insertMissingArrayItems(source, target) {
|
||||
for (const item of source) {
|
||||
if (!target.includes(item)) {
|
||||
const index = source.indexOf(item);
|
||||
target.splice(index, 0, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setSettingByName(setting, value, trigger) {
|
||||
if (value === null || value === undefined) {
|
||||
return;
|
||||
|
@ -819,6 +834,7 @@ function setSettingByName(setting, value, trigger) {
|
|||
|
||||
if ('sampler_priority' === setting) {
|
||||
value = Array.isArray(value) ? value : OOBA_DEFAULT_ORDER;
|
||||
insertMissingArrayItems(OOBA_DEFAULT_ORDER, value);
|
||||
sortOobaItemsByOrder(value);
|
||||
settings.sampler_priority = value;
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue