Fix perk tree not working after switching themes

This commit is contained in:
SpectralFlame 2021-08-17 12:41:47 -05:00
parent b0450435a2
commit 87cdb43541
4 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,8 @@ Vue.component("select-theme", {
},
setTheme(theme) {
theme.set();
PerkNetwork.makeNetwork();
PerkNetwork.forceNetworkRemake();
PerkNetwork.initializeIfNeeded();
}
},
template: `

View File

@ -145,6 +145,9 @@ const PerkNetwork = {
const network = new vis.Network(container, nodeData, nodeOptions);
this.network = network;
},
forceNetworkRemake() {
this.container = undefined;
},
resetPosition() {
this.network.moveTo({ position: { x: -600, y: -300 }, scale: 0.8, offset: { x: 0, y: 0 } });
},

View File

@ -22,7 +22,7 @@ Vue.component("pp-label", {
<div class="c-perk-tab__header">
You have <span class="c-perk-tab__perk-points">{{ format(pp, 2, 0) }}</span> {{ "Perk Point" | pluralize(pp) }}.
<br>
Perks choices are permanent and cannot be respecced.
Perk choices are permanent and cannot be respecced.
<br>
<primary-button-on-off
v-model="fixedLoadPos"

View File

@ -58,7 +58,8 @@ Theme.current = function() {
Theme.set = function(name) {
const theme = Themes.find(name);
theme.set();
PerkNetwork.makeNetwork();
PerkNetwork.forceNetworkRemake();
PerkNetwork.initializeIfNeeded();
return theme;
};