protected override void OnSelectionChanged() { base.OnSelectionChanged(); bool canOperate = SelectedHitObjects.Count() > 1 || SelectedHitObjects.Any(s => s is Slider); SelectionBox.CanRotate = canOperate; SelectionBox.CanScaleX = canOperate; SelectionBox.CanScaleY = canOperate; }
/// <summary> /// Returns a gamefield-space quad surrounding the provided points. /// </summary> /// <param name="points">The points to calculate a quad for.</param> private Quad getSurroundingQuad(IEnumerable <Vector2> points) { if (!SelectedHitObjects.Any()) { return(new Quad()); } Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue); Vector2 maxPosition = new Vector2(float.MinValue, float.MinValue); // Go through all hitobjects to make sure they would remain in the bounds of the editor after movement, before any movement is attempted foreach (var p in points) { minPosition = Vector2.ComponentMin(minPosition, p); maxPosition = Vector2.ComponentMax(maxPosition, p); } Vector2 size = maxPosition - minPosition; return(new Quad(minPosition.X, minPosition.Y, size.X, size.Y)); }