22 lines
709 B
Dart
22 lines
709 B
Dart
|
void _drawHArrow(Canvas canvas, Size size, Offset from, Offset to, [bool doubleSided = false]) {
|
|||
|
Path path;
|
|||
|
|
|||
|
// The arrows usually looks better with rounded caps.
|
|||
|
Paint paint = ... // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
var length = sqrt((to.dx - from.dx) * (to.dx - from.dx) +
|
|||
|
(to.dy - from.dy) * (to.dy - from.dy));
|
|||
|
|
|||
|
path = Path();
|
|||
|
path.moveTo(from.dx, from.dy);
|
|||
|
path.relativeCubicTo(
|
|||
|
0,
|
|||
|
0,
|
|||
|
-(from.dx + to.dx + length) / (length) - 40,
|
|||
|
-(from.dy + to.dy + length) / (length) - 40,
|
|||
|
to.dx - from.dx,
|
|||
|
to.dy - from.dy);
|
|||
|
path =
|
|||
|
ArrowPath.make(path: path, isDoubleSided: doubleSided, tipLength: 16);
|
|||
|
canvas.drawPath(path, paint);
|
|||
|
}
|