public void Move(Vector2 mousePos) {
Vector2 spacing = mousePos - attachedTo.rect.center;
Vector2 scaledSpacing = new Vector2(spacing.x / attachedTo.rect.width, spacing.y / attachedTo.rect.height);
if(Mathf.Abs(scaledSpacing.x) > Mathf.Abs(scaledSpacing.y)) {
if (spacing.x < 0) {
orientation = HandleOrientation.LEFT;
} else {
orientation = HandleOrientation.RIGHT;
}
offset = spacing.y;
} else {
if(spacing.y < 0) {
orientation = HandleOrientation.TOP;
} else {
orientation = HandleOrientation.BOTTOM;
}
offset = spacing.x;
}
CalculatePosition();
}