invertDistance method
Inverts a distance in canvas to abstract distance.
Implementation
@override
double invertDistance(double canvasDistance, [Dim? dim]) {
final h = canvasDistance / (horizontals.last - horizontals.first).abs();
final v = canvasDistance / (verticals.last - verticals.first).abs();
if (dim == Dim.x) {
return transposed ? v : h;
} else if (dim == Dim.y) {
return transposed ? h : v;
} else {
return (h + v) / 2;
}
}