worldToLocal method

Vec2D? worldToLocal(
  1. Vec2D position
)

Convert a world position to local for the mounted artboard.

Implementation

Vec2D? worldToLocal(Vec2D position) {
  var mounted = mountedArtboard;
  if (mounted == null) {
    return null;
  }
  var toMountedArtboard = Mat2D();
  if (!Mat2D.invert(toMountedArtboard, mounted.worldTransform)) {
    return null;
  }
  return Vec2D.transformMat2D(Vec2D(), position, toMountedArtboard);
}