mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 04:35:58 +00:00
gravity exponent
This commit is contained in:
parent
2303cf1611
commit
d85b9c9bb5
@ -18,6 +18,7 @@ const GRAVITY_Y = 0.01;
|
|||||||
const REPULSION = 1000;
|
const REPULSION = 1000;
|
||||||
const MAX_FORCE_SIZE = 100;
|
const MAX_FORCE_SIZE = 100;
|
||||||
const NODE_MARGIN = 30;
|
const NODE_MARGIN = 30;
|
||||||
|
const GRAVITY_EXPONENT = 1.05;
|
||||||
|
|
||||||
// const MOVE_STEP = 20;
|
// const MOVE_STEP = 20;
|
||||||
// const MOVE_BIG_STEP = 50;
|
// const MOVE_BIG_STEP = 50;
|
||||||
@ -210,8 +211,15 @@ class ForceAlgorithmStep {
|
|||||||
|
|
||||||
applyGravity() {
|
applyGravity() {
|
||||||
for (const node of _.values(this.layout.nodes)) {
|
for (const node of _.values(this.layout.nodes)) {
|
||||||
var direction = node.position.multiply(-1.0);
|
this.applyForce(
|
||||||
this.applyForce(node, new Vector2D(direction.x * GRAVITY_X, direction.y * GRAVITY_Y));
|
node,
|
||||||
|
// new Vector2D(-node.position.x * GRAVITY_X, -node.position.y * GRAVITY_Y)
|
||||||
|
|
||||||
|
new Vector2D(
|
||||||
|
-Math.pow(Math.abs(node.position.x), GRAVITY_EXPONENT) * Math.sign(node.position.x) * GRAVITY_X,
|
||||||
|
-Math.pow(Math.abs(node.position.y), GRAVITY_EXPONENT) * Math.sign(node.position.y) * GRAVITY_Y
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user