// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; namespace osu.Game.Rulesets.Edit.Layers.Selection { /// /// A that has s around its border. /// public class HandleContainer : CompositeDrawable { /// /// Invoked when a requires the current drag rectangle. /// public Func GetDragRectangle; /// /// Invoked when a wants to update the drag rectangle. /// public Action UpdateDragRectangle; /// /// Invoked when a has finished updates to the drag rectangle. /// public Action FinishDrag; public HandleContainer() { InternalChildren = new Drawable[] { new Handle { Anchor = Anchor.TopLeft, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.TopCentre, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.TopRight, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.BottomLeft, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.CentreRight, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.BottomRight, Origin = Anchor.Centre }, new Handle { Anchor = Anchor.BottomCentre, Origin = Anchor.Centre }, new OriginHandle { Anchor = Anchor.Centre, Origin = Anchor.Centre } }; InternalChildren.OfType().ForEach(m => { m.GetDragRectangle = () => GetDragRectangle(); m.UpdateDragRectangle = r => UpdateDragRectangle(r); m.FinishDrag = () => FinishDrag(); }); } } }