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