reverted position balancing

This commit is contained in:
Морозов Андрей 2021-11-06 02:41:59 +04:00
parent 9ff6dd2745
commit f82cdf0814
1 changed files with 17 additions and 20 deletions

View File

@ -86,8 +86,7 @@ class CurvePainter extends CustomPainter {
return higest;
}
Map<int, Offset> getDotPos(int dotsAm, Size size, int exclude) {
dotsAm--;
Map<int, Offset> getDotPos(int dotsAm, Size size, [int? exclude]) {
Map<int, Offset> off = <int, Offset>{};
var width = size.width / 2;
var height = size.height / 2;
@ -96,7 +95,6 @@ class CurvePainter extends CustomPainter {
double x = cos(2 * pi * i / dotsAm) * circleRad + width;
double y = sin(2 * pi * i / dotsAm) * circleRad + height;
if (i == exclude - 1) add++;
off[i + add] = Offset(x, y);
}
@ -125,7 +123,7 @@ class CurvePainter extends CustomPainter {
path.relativeCubicTo(0, 0, -(from.dx + to.dx) / length - 40,
-(from.dy + to.dy) / length - 40, to.dx - from.dx, to.dy - from.dy);
path =
ArrowPath.make(path: path, isDoubleSided: doubleSided, tipLength: 13);
ArrowPath.make(path: path, isDoubleSided: doubleSided, tipLength: 16);
canvas.drawPath(path, paint);
}
@ -212,14 +210,13 @@ class CurvePainter extends CustomPainter {
//Offset(size.width, size.height / 2));
//gr = getGraph();
int higest = getHighConnections();
if (higest > -1) {
var off = getDotPos(gr.getDotAmount(), size, higest);
off[higest] = Offset(size.width / 2, size.height / 2);
//int higest = getHighConnections();
//if (higest > -1) {
var off = getDotPos(gr.getDotAmount(), size); //, higest);
//off[higest] = Offset(size.width / 2, size.height / 2);
for (int i in off.keys) {
drawDot(canvas, off[i]!);
drawDotNames(
canvas, off[i]!, "${gr.getDots()[i - 1].getName()}:[${i}]");
drawDotNames(canvas, off[i]!, "${gr.getDots()[i - 1].getName()}:[${i}]");
}
//var g = gr.getNoRepeatDots();
//print(g);
@ -228,7 +225,7 @@ class CurvePainter extends CustomPainter {
//pringArr(canvas, size);
//drawArrow(canvas, Offset(size.width / 2, size.height / 2),
// Offset(size.width / 2 + 50, size.height / 2 + 200));
}
//}
}
@override