public static BBoxHandle GetSelectionHandle(Rect bounds, HandleKind kind, float rescale) { Vector2 pos; var radius = 4f * rescale; var margin = 4.5f * rescale; if (kind.HasFlag(HandleKind.Right)) { pos.X = bounds.Right + radius + margin; } else if (kind.HasFlag(HandleKind.Left)) { pos.X = bounds.Left - radius - margin; } else { pos.X = .5f * (bounds.Left + bounds.Right); } if (kind.HasFlag(HandleKind.Top)) { pos.Y = bounds.Top + radius + margin; } else if (kind.HasFlag(HandleKind.Bottom)) { pos.Y = bounds.Bottom - radius - margin; } else { pos.Y = .5f * (bounds.Bottom + bounds.Top); } return(new BBoxHandle(kind, pos)); }