LayoutFarm.Demo_DragSelectionBox.SetupSelectionBoxProperties C# (CSharp) Method

SetupSelectionBoxProperties() private method

private SetupSelectionBoxProperties ( UISelectionBox selectionBox ) : void
selectionBox UISelectionBox
return void
        void SetupSelectionBoxProperties(UISelectionBox selectionBox)
        {
            selectionBox.MouseUp += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    FindSelectedUserBoxes();
                    selectionBox.Visible = false;
                    selectionBox.SetSize(1, 1);
                    selectionBoxIsShown = false;
                }
            };
            selectionBox.MouseDrag += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    Point sel_globalLocation = selectionBox.GetGlobalLocation();
                    int x = e.CapturedMouseX;
                    int y = e.CapturedMouseY;
                    //temp fix here 
                    //TODO: get global position of selected box

                    int w = selectionBox.Left + e.DiffCapturedX;
                    int h = selectionBox.Top + e.DiffCapturedY;
                    if (w < 0)
                    {
                        w = -w;
                        x -= w;
                    }
                    if (h < 0)
                    {
                        h = -h;
                        y -= h;
                    }
                    //set width and height
                    selectionBox.SetBounds(x, y, w, h);
                    e.StopPropagation();
                }
            };
        }
        static void MoveWithSnapToGrid(UIControllerBox controllerBox, int dx, int dy)