Пример #1
0
        /// <summary>
        /// Helper to get how far the thumb needs to move to be at the
        /// hand pointer position.
        /// </summary>
        /// <param name="kinectHandPointer">Hand pointer to check</param>
        /// <returns>How far the thumb control needs to move</returns>
        private Vector GetDragDelta(HandPointer kinectHandPointer)
        {
            var handPointerRelativeToGripEventTarget = kinectHandPointer.GetPosition(this.gripEventTarget);
            var thumbRelativeToGripEventTarget       = this.TranslatePoint(new Point(this.ActualWidth / 2.0, this.ActualHeight / 2.0), this.gripEventTarget);

            return(handPointerRelativeToGripEventTarget - thumbRelativeToGripEventTarget);
        }
Пример #2
0
        private void OnHandMove(object source, HandPointerEventArgs args)
        {
            //Double.Parse(this.rowCanvas.Height.Value.ToString())
            HandPointer ptr = args.HandPointer;

            if (this.isGrip)
            {
                Point j1P = kinectRegion.PointToScreen(ptr.GetPosition(kinectRegion));

                if (j1P.X >= this.paint.Margin.Left && j1P.X <= Screen.PrimaryScreen.Bounds.Width && j1P.Y >= this.paint.Margin.Top && j1P.Y <= Screen.PrimaryScreen.Bounds.Height)
                {
                    // ptr.IsInGripInteraction = true;

                    this.paint.Children.Add(this.ctl.paintCanvas(j1P, this.colorSelec.Background));
                }
            }
        }
Пример #3
0
        private void HandleHandPointerGrip(HandPointer handPointer)
        {
            if (handPointer == null)
            {
                return;
            }

            if (this.capturedHandPointer != handPointer)
            {
                if (handPointer.Captured == null)
                {
                    handPointer.Capture(element);
                }
                else
                {
                    return;
                }
            }

            this.lastGripStatus = GripState.Gripped;
            this.gripPoint      = handPointer.GetPosition(element);
        }
Пример #4
0
        private void HandleHandPointerGrip(HandPointer handPointer)
        {
            if (handPointer == null)
            {
                return;
            }

            if (this.capturedHandPointer != handPointer)
            {
                if (handPointer.Captured == null)
                {
                    // Only capture hand pointer if it isn't already captured
                    handPointer.Capture(this);
                }
                else
                {
                    // Some other control has capture, ignore grip
                    return;
                }
            }

            Grip();
            this.gripPoint = handPointer.GetPosition(this);
        }