FlatRedBall.AnimationEditorForms.Wireframe.Ruler.HandleMovingGuides C# (CSharp) Method

HandleMovingGuides() private method

private HandleMovingGuides ( bool isCursorInWindow ) : void
isCursorInWindow bool
return void
        private void HandleMovingGuides(bool isCursorInWindow)
        {

            float guideSpacePosition;
            if (this.RulerSide == Wireframe.RulerSide.Left)
            {
                guideSpacePosition = mCursor.Y - mOffsetSprite.Y;
            }
            else
            {
                guideSpacePosition = mCursor.X - mOffsetSprite.X;
            }


            //guideSpaceY; ;

            Line guideOver = null;
            if (mGrabbedGuide == null && isCursorInWindow)
            {
                foreach (Line line in mGuides)
                {
                    if ((this.RulerSide == Wireframe.RulerSide.Left && System.Math.Abs(line.Y - guideSpacePosition) < 3) ||
                        (this.RulerSide == Wireframe.RulerSide.Top && System.Math.Abs(line.X - guideSpacePosition) < 3))
                    {
                        guideOver = line;
                        break;
                    }

                }
            }

            if (guideOver != null || mGrabbedGuide != null)
            {
                System.Windows.Forms.Cursor cursorToSet;
                if (this.RulerSide == Wireframe.RulerSide.Left)
                {
                    cursorToSet = System.Windows.Forms.Cursors.SizeNS;
                }
                else // top
                {
                    cursorToSet = System.Windows.Forms.Cursors.SizeWE;
                }
                if (WinCursor.Current != cursorToSet)
                {
                    WinCursor.Current = cursorToSet;
                    this.mControl.Cursor = cursorToSet;
                }
            }

            if (mCursor.IsInWindow && mCursor.PrimaryPush)
            {
                mGrabbedGuide = guideOver;

            }
            if (mCursor.PrimaryDown && mGrabbedGuide != null)
            {
                if (this.RulerSide == Wireframe.RulerSide.Left)
                {
                    mGrabbedGuide.Y = guideSpacePosition;
                }
                else
                {
                    mGrabbedGuide.X = guideSpacePosition;
                }
            }

            UpdateGrabbedGuideText(guideSpacePosition);

            if (!mCursor.PrimaryDown)
            {
                if (mGrabbedGuide != null && !isCursorInWindow)
                {
                    mGuides.Remove(mGrabbedGuide);
                    mManagers.ShapeManager.Remove(mGrabbedGuide);
                }
                mGrabbedGuide = null;
            }
        }