feat(calc): read manually added weights

This commit is contained in:
Kritagya Bhattarai (CalfMoon) 2026-03-29 19:52:52 +05:45
parent fd824ea406
commit d212d1f57f

View file

@ -11,10 +11,12 @@ export default class NodeFactor extends Plugin {
this.addSettingTab(new NodeFactorSettingTab(this.app, this));
this.registerEvent(
this.app.workspace.on("active-leaf-change", () => {
// we can still use cache when only active leaf changes
this.updateGraph();
}),
this.app.workspace.on("active-leaf-change", () =>
this.updateGraph(),
),
);
this.registerEvent(
this.app.workspace.on("layout-change", () => this.updateGraph()),
);
// clear cache when there is change in the vault
@ -71,6 +73,14 @@ export default class NodeFactor extends Plugin {
const settings = this.settings;
let weight = 0;
let manualFileData = settings.manual.find(
(manualFileData) => manualFileData.id == node.id,
);
if (manualFileData != null) {
console.log(manualFileData);
return manualFileData.weight;
}
weight += Object.keys(node.reverse).length * settings.bwdMultiplier;
if (settings.fwdTree) {
weight +=