mirror of
https://github.com/calfmoon/node-factor.git
synced 2026-07-22 05:42:24 +00:00
feat(ui): add option to remove manually added weights
This commit is contained in:
parent
3c56ee6e74
commit
43ea5c276a
2 changed files with 18 additions and 2 deletions
|
|
@ -73,11 +73,10 @@ export default class NodeFactor extends Plugin {
|
|||
const settings = this.settings;
|
||||
let weight = 0;
|
||||
|
||||
let manualFileData = settings.manual.find(
|
||||
const manualFileData = settings.manual.find(
|
||||
(manualFileData) => manualFileData.id == node.id,
|
||||
);
|
||||
if (manualFileData != null) {
|
||||
console.log(manualFileData);
|
||||
return manualFileData.weight;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,5 +146,22 @@ export default class NodeFactorSettingTab extends PluginSettingTab {
|
|||
this.plugin.recalculateSize();
|
||||
});
|
||||
});
|
||||
|
||||
// Display all manually added weights
|
||||
this.plugin.settings.manual.forEach((value: FileData) => {
|
||||
new Setting(containerEl)
|
||||
.setName(value.id)
|
||||
.setDesc(`Weight: ${String(value.weight)}`)
|
||||
.addButton((button) => {
|
||||
button
|
||||
.setIcon("trash")
|
||||
.setTooltip("Remove Manually added size")
|
||||
.onClick(async () => {
|
||||
this.plugin.settings.manual.remove(value);
|
||||
await this.plugin.saveSettings();
|
||||
this.display();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue