private InputEventProcessResult ProcessMouseEvent(IMouseEvent args)
        {
            if ((args.State.Buttons & MouseButtons.Left) == 0)
            {
                nodeRectAspect.Node.GetComponent <IRectangleComponent>().Rectangle = nodeRectAspect.Rectangle;
                undoRedo.OnChange();
                return(InputEventProcessResult.ReleaseLock);
            }
            if (!args.IsOfType(MouseEventType.Move))
            {
                return(InputEventProcessResult.DontCare);
            }
            var globalRay = args.Viewport.GetGlobalRayForPixelPos(args.State.Position);

            if (!space.TryFindPoint2D(globalRay, out var pos2D))
            {
                return(InputEventProcessResult.StopPropagating);
            }
            var minCorner = pos2D - anchorPointOnRect;
            var maxCorner = minCorner + new Vector2(originalRect.Width, originalRect.Height);

            nodeRectAspect.Rectangle = new AaRectangle2(minCorner, maxCorner);
            return(InputEventProcessResult.StopPropagating);
        }
        private InputEventProcessResult ProcessMouseEvent(IMouseEvent args)
        {
            if ((args.State.Buttons & MouseButtons.Left) == 0)
            {
                nodeRectAspect.Node.GetComponent <IRectangleComponent>().Rectangle = nodeRectAspect.Rectangle;
                undoRedo.OnChange();
                return(InputEventProcessResult.ReleaseLock);
            }
            if (!args.IsOfType(MouseEventType.Move))
            {
                return(InputEventProcessResult.DontCare);
            }
            var globalRay = args.Viewport.GetGlobalRayForPixelPos(args.State.Position);

            if (!space.TryFindPoint2D(globalRay, out var pos2D))
            {
                return(InputEventProcessResult.StopPropagating);
            }
            var or  = originalRect;
            var asp = originalRect.Width / originalRect.Height;
            var converseAspectRatio = (args.KeyModifiers & KeyModifiers.Shift) != 0;

            switch (place)
            {
            case ResizeRectangleGizmoPlace.Left:
                nodeRectAspect.Rectangle = NewRect(pos2D.X, or.MinY, or.MaxX, or.MaxY);
                break;

            case ResizeRectangleGizmoPlace.Right:
                nodeRectAspect.Rectangle = NewRect(or.MinX, or.MinY, pos2D.X, or.MaxY);
                break;

            case ResizeRectangleGizmoPlace.Bottom:
                nodeRectAspect.Rectangle = NewRect(or.MinX, pos2D.Y, or.MaxX, or.MaxY);
                break;

            case ResizeRectangleGizmoPlace.Top:
                nodeRectAspect.Rectangle = NewRect(or.MinX, or.MinY, or.MaxX, pos2D.Y);
                break;

            case ResizeRectangleGizmoPlace.BottomLeft:
            {
                var left = converseAspectRatio ? or.MaxX - asp * (or.MaxY - pos2D.Y) : pos2D.X;
                nodeRectAspect.Rectangle = NewRect(left, pos2D.Y, or.MaxX, or.MaxY);
                break;
            }

            case ResizeRectangleGizmoPlace.BottomRight:
            {
                var right = converseAspectRatio ? or.MinX + asp * (or.MaxY - pos2D.Y) : pos2D.X;
                nodeRectAspect.Rectangle = NewRect(or.MinX, pos2D.Y, right, or.MaxY);
                break;
            }

            case ResizeRectangleGizmoPlace.TopLeft:
            {
                var left = converseAspectRatio ? or.MaxX - asp * (pos2D.Y - or.MinY) : pos2D.X;
                nodeRectAspect.Rectangle = NewRect(left, or.MinY, or.MaxX, pos2D.Y);
                break;
            }

            case ResizeRectangleGizmoPlace.TopRight:
            {
                var right = converseAspectRatio ? or.MinX + asp * (pos2D.Y - or.MinY) : pos2D.X;
                nodeRectAspect.Rectangle = NewRect(or.MinX, or.MinY, right, pos2D.Y);
                break;
            }
            }
            return(InputEventProcessResult.StopPropagating);
        }