mirror of
https://github.com/calfmoon/node-factor.git
synced 2026-07-22 05:42:24 +00:00
fix: update graph on settings change (#4)
This commit is contained in:
parent
b23deebdf5
commit
c5739de84c
2 changed files with 11 additions and 4 deletions
12
src/main.ts
12
src/main.ts
|
|
@ -40,16 +40,16 @@ export default class NodeFactor extends Plugin {
|
|||
|
||||
// clear cache when there is change in the vault
|
||||
this.registerEvent(
|
||||
this.app.vault.on("create", () => (this.storedSized = [])),
|
||||
this.app.vault.on("create", () => this.clearSizeCache()),
|
||||
);
|
||||
this.registerEvent(
|
||||
this.app.vault.on("modify", () => (this.storedSized = [])),
|
||||
this.app.vault.on("modify", () => this.clearSizeCache()),
|
||||
);
|
||||
this.registerEvent(
|
||||
this.app.vault.on("delete", () => (this.storedSized = [])),
|
||||
this.app.vault.on("delete", () => this.clearSizeCache()),
|
||||
);
|
||||
this.registerEvent(
|
||||
this.app.vault.on("rename", () => (this.storedSized = [])),
|
||||
this.app.vault.on("rename", () => this.clearSizeCache()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +128,10 @@ export default class NodeFactor extends Plugin {
|
|||
return size;
|
||||
}
|
||||
|
||||
clearSizeCache() {
|
||||
this.storedSized = [];
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export default class NodeFactorSettingTab extends PluginSettingTab {
|
|||
.setDynamicTooltip()
|
||||
.setValue(this.plugin.settings.fwdMultiplier)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.clearSizeCache();
|
||||
this.plugin.settings.fwdMultiplier = value;
|
||||
await this.plugin.saveSettings();
|
||||
}),
|
||||
|
|
@ -35,6 +36,7 @@ export default class NodeFactorSettingTab extends PluginSettingTab {
|
|||
toggle
|
||||
.setValue(this.plugin.settings.fwdTree)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.clearSizeCache();
|
||||
this.plugin.settings.fwdTree = value;
|
||||
await this.plugin.saveSettings();
|
||||
}),
|
||||
|
|
@ -49,6 +51,7 @@ export default class NodeFactorSettingTab extends PluginSettingTab {
|
|||
.setDynamicTooltip()
|
||||
.setValue(this.plugin.settings.bwdMultiplier)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.clearSizeCache();
|
||||
this.plugin.settings.bwdMultiplier = value;
|
||||
await this.plugin.saveSettings();
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue