mirror of
https://github.com/zadam/trilium.git
synced 2025-01-14 02:58:39 +08:00
fix link map zoom after reload and some tweaks to springy
This commit is contained in:
parent
d4e27c1b76
commit
a81b00e130
3 changed files with 7 additions and 8 deletions
BIN
db/demo.tar
BIN
db/demo.tar
Binary file not shown.
|
@ -417,11 +417,12 @@
|
|||
{
|
||||
var d = point1.p.subtract(point2.p);
|
||||
var distance = d.magnitude() + 0.1; // avoid massive forces at small distances (and divide by zero)
|
||||
|
||||
var direction = d.normalise();
|
||||
|
||||
// apply force to each end point
|
||||
point1.applyForce(direction.multiply(this.repulsion).divide(distance * distance * 0.5));
|
||||
point2.applyForce(direction.multiply(this.repulsion).divide(distance * distance * -0.5));
|
||||
point1.applyForce(direction.multiply(this.repulsion).divide(distance * distance * distance * 0.5));
|
||||
point2.applyForce(direction.multiply(this.repulsion).divide(distance * distance * distance * -0.5));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -65,8 +65,9 @@ export default class LinkMap {
|
|||
graph,
|
||||
// param explanation here: https://github.com/dhotson/springy/issues/58
|
||||
400.0, // Spring stiffness
|
||||
400.0, // Node repulsion
|
||||
0.15 // Damping
|
||||
600.0, // Node repulsion
|
||||
0.15, // Damping
|
||||
0.1 // min energy threshold
|
||||
);
|
||||
|
||||
const getNoteBox = noteId => {
|
||||
|
@ -163,9 +164,6 @@ export default class LinkMap {
|
|||
);
|
||||
|
||||
this.renderer.start();
|
||||
|
||||
// long rendering is annoying and by 3rd seconds the basic layout should be finished
|
||||
setTimeout(() => this.renderer.stop(), 3000);
|
||||
}
|
||||
|
||||
moveToCenterOfElement(element) {
|
||||
|
@ -213,7 +211,7 @@ export default class LinkMap {
|
|||
this.$linkMapContainer.empty();
|
||||
|
||||
// reset zoom/pan
|
||||
this.pzInstance.zoomTo(0, 0, this.options.zoom);
|
||||
this.pzInstance.zoomAbs(0, 0, this.options.zoom);
|
||||
this.pzInstance.moveTo(0, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue