mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix double refresh of note map
This commit is contained in:
parent
0264e847ef
commit
5358b58191
@ -1,5 +1,4 @@
|
|||||||
import BasicWidget from "./basic_widget.js";
|
import BasicWidget from "./basic_widget.js";
|
||||||
import appContext from "../services/app_context.js";
|
|
||||||
|
|
||||||
export default class NoteContextAwareWidget extends BasicWidget {
|
export default class NoteContextAwareWidget extends BasicWidget {
|
||||||
isNoteContext(ntxId) {
|
isNoteContext(ntxId) {
|
||||||
|
@ -117,15 +117,15 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
|
|||||||
.linkCanvasObjectMode(() => "after");
|
.linkCanvasObjectMode(() => "after");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mapRootNoteId = this.getMapRootNoteId();
|
||||||
|
const data = await this.loadNotesAndRelations(mapRootNoteId);
|
||||||
|
const nodeLinkRatio = data.nodes.length / data.links.length;
|
||||||
|
|
||||||
this.graph.d3Force('link').distance(40);
|
this.graph.d3Force('link').distance(40);
|
||||||
this.graph.d3Force('center').strength(0.01);
|
this.graph.d3Force('center').strength(0.01);
|
||||||
this.graph.d3Force('charge').strength(-30);
|
this.graph.d3Force('charge').strength(-20 / nodeLinkRatio);
|
||||||
this.graph.d3Force('charge').distanceMax(1000);
|
this.graph.d3Force('charge').distanceMax(1000);
|
||||||
|
|
||||||
let mapRootNoteId = this.getMapRootNoteId();
|
|
||||||
|
|
||||||
const data = await this.loadNotesAndRelations(mapRootNoteId);
|
|
||||||
|
|
||||||
this.renderData(data);
|
this.renderData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,4 +48,15 @@ export default class TypeWidget extends NoteContextAwareWidget {
|
|||||||
this.focus();
|
this.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// events should be propagated manually to the children widgets
|
||||||
|
handleEventInChildren(name, data) {
|
||||||
|
if (['activeContextChanged', 'setNoteContext'].includes(name)) {
|
||||||
|
// won't trigger .refresh();
|
||||||
|
return super.handleEventInChildren('setNoteContext', data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ const cls = require('./cls');
|
|||||||
const entityChangesService = require('./entity_changes');
|
const entityChangesService = require('./entity_changes');
|
||||||
const optionsService = require('./options');
|
const optionsService = require('./options');
|
||||||
const Branch = require('../becca/entities/branch');
|
const Branch = require('../becca/entities/branch');
|
||||||
const dateUtils = require('./date_utils');
|
|
||||||
const attributeService = require('./attributes');
|
const attributeService = require('./attributes');
|
||||||
const noteRevisionService = require('./note_revisions');
|
const noteRevisionService = require('./note_revisions');
|
||||||
const becca = require("../becca/becca");
|
const becca = require("../becca/becca");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user