Choreoh.MainWindow.buttonUpdater C# (CSharp) Method

buttonUpdater() private method

private buttonUpdater ( Microsoft.Kinect.Joint handJoint ) : void
handJoint Microsoft.Kinect.Joint
return void
        private void buttonUpdater(Joint handJoint)
        {
            hand.SetPosition(handJoint);
            if (beforeRecordCanvas.Visibility == Visibility.Visible ||
                afterRecordCanvas.Visibility == Visibility.Visible)
                return;
            foreach (HoverButton hb in buttonList)
            {
                if (blackBack.Visibility == Visibility.Visible)
                {
                    if (Canvas.GetZIndex(blackBack) >= Canvas.GetZIndex(hb) && Canvas.GetZIndex(blackBack) >= Canvas.GetZIndex((Canvas)hb.Parent))
                        continue;
                }
                hb.Check(hand);
            }

            if (commentButtonCanvas.Visibility == Visibility.Visible ||
                    segmentButtonCanvas.Visibility == Visibility.Visible ||
                    beforeRecordCanvas.Visibility == Visibility.Visible ||
                    afterRecordCanvas.Visibility == Visibility.Visible)
                return;

            foreach (HoverButton hb in segmentList)
            {
                hb.Check(hand);
            }

            if (isSelectingEndSegment || isSelectingPlaySegment || isSelectingPlaySongSelection || isSelectingRecordSegment
                || isSelectingStartSegment)
            {
                framesIntoScrollingLeft = 0;
                framesIntoScrollingRight = 0;
                return;
            }

            double topPos = Canvas.GetTop(hand);
            if (topPos < 450 || topPos > (450 + 160))
            {
               // Debug.WriteLine(DateTime.Now.ToString() + " - hand not in scrolling range");
                framesIntoScrollingLeft = 0;
                framesIntoScrollingRight = 0;
                return;
            }

            double leftPos = Canvas.GetLeft(hand);
            if (leftPos >= (964 - 100))
            {
                framesIntoScrollingRight++;
               // Debug.WriteLine("Inc scroll right counter: " + framesIntoScrollingRight);
            }
            else if (leftPos <= 100)
            {
                framesIntoScrollingLeft++;
               // Debug.WriteLine("Inc scroll left counter: " + framesIntoScrollingLeft);
            }
            else
            {
                framesIntoScrollingLeft = 0;
                framesIntoScrollingRight = 0;
            }
            if (framesIntoScrollingRight > framesNeededToScroll)
            {
                moveCanvas(1);
                framesIntoScrollingLeft = 0;
                framesIntoScrollingRight = 0;
            } else if (framesIntoScrollingLeft > framesNeededToScroll)
            {
                moveCanvas(-1);
                framesIntoScrollingLeft = 0;
                framesIntoScrollingRight = 0;
            }
        }