mapPoint method

DiagramPoint mapPoint(
  1. DiagramPoint point
)

Implementation

DiagramPoint mapPoint(DiagramPoint point) {
  if (!point.x.isFinite || !point.y.isFinite) {
    throw ArgumentError.value(point, 'point', 'must be finite');
  }
  if (fromBounds == toBounds) return point;
  final local = point.rotateAround(fromBounds.center, -rotation);
  final mapped = DiagramPoint(
    toBounds.left + (local.x - fromBounds.left) * scaleX,
    toBounds.top + (local.y - fromBounds.top) * scaleY,
  ).rotateAround(fromBounds.center, rotation);
  if (!mapped.x.isFinite || !mapped.y.isFinite) {
    throw ArgumentError('Resize exceeds finite geometry');
  }
  return mapped;
}