/// <summary>
        /// Check if we hit the handles
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="viewport"></param>
        /// <returns></returns>
        private int GetGrableHandleHit(int x, int y, BaseViewport viewport)
        {
            MapObjectGroup selectedMapObjectGroup = controller.Selection;

            if (selectedMapObjectGroup.Empty)
            {
                return((int)SolidGrabHandles.HitStatus.None);
            }

            Matrix4 toGridMatrix = viewport.Camera.GetWorldMatrix().ClearTranslation();

            SolidGrabHandles handles = controller.RubberBand.Handles;

            handles.CreateHandles(selectedMapObjectGroup, toGridMatrix, viewport.Zoom);

            return(handles.CheckHit(viewport.ViewportToRay(x, y)));
        }
        public override void OnRender(Graphics.Graphics graphics, BaseViewport viewport)
        {
            BaseViewportCamera   camera     = viewport.Camera;
            RubberBand           rubberband = controller.RubberBand;
            SolidRenderOperation render     = new SolidRenderOperation
            {
                Viewport = viewport,
                Graphics = graphics
            };

            // Draw all solids
            if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE)
            {
                GL.Enable(EnableCap.DepthTest);
            }

            graphics.BeginDraw(camera.GetViewMatrix() * camera.GetProjMatrix());

            foreach (MapObject mapObject in controller.SceneDocument)
            {
                if (mapObject.Selected)
                {
                    continue;
                }

                mapObject.PerformOperation(render);
            }

            controller.Selection?.PerformOperation(render);

            // only in orthographic viewport
            if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE)
            {
                // draw rubberband
                if (rubberband.Bounds.HasVolume2D)
                {
                    graphics.DrawWireframeAabb(rubberband.Bounds, Graphics.Graphics.LineType.LineDashed, rubberband.Color, rubberband.Transformation, viewport.Zoom);
                }
                else
                {
                    // draw "rubberband" for the selection
                    graphics.DrawWireframeAabb(controller.Selection?.Bounds, Graphics.Graphics.LineType.LineDashed,
                                               viewport.RenderMode == BaseViewport.RenderModes.SOLID ? Color.Yellow : Color.Red,
                                               Matrix4.Identity, viewport.Zoom);
                }

                // draw grabhandles for selection
                if (controller.RubberBand.ShowGrabhandles)
                {
                    SolidGrabHandles handles        = controller.RubberBand.Handles;
                    Matrix4          viewportMatrix = viewport.Camera.GetWorldMatrix().ClearTranslation();
                    handles.CreateHandles(controller.Selection, viewportMatrix, viewport.Zoom);
                    handles.Render(graphics);
                }
            }

            graphics.EndDraw();

            if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE)
            {
                GL.Disable(EnableCap.DepthTest);
            }
        }