Fix resetting application settings and player settings doing more than intended

This commit is contained in:
Thomas Weber committed 2021-12-11 22:29:33 -06:00
1 parent 5d84898691
commit dce7661005
1 file changed
+12 -3
+12 -3
View File
@@ -142,8 +142,17 @@
const resetOptions = (properties) => {
for (const key of properties) {
$options[key] = deepClone(defaultOptions[key]);
let current = $options;
let defaults = defaultOptions;
const parts = key.split('.');
const lastPart = parts.pop();
for (const i of parts) {
current = current[i];
defaults = defaults[i];
}
current[lastPart] = deepClone(defaults[lastPart]);
}
$options = $options;
};
onDestroy(() => {
@@ -301,7 +310,7 @@
$icon = null;
$loadingScreenImage = null;
resetOptions([
'app',
'app.windowTitle',
'loadingScreen',
'autoplay',
'controls',
@@ -655,7 +664,7 @@
accent="#FF661A"
reset={$options.target === 'zip' ? null : () => {
resetOptions([
'app'
'app.packageName'
])
}}
>