private void TwoHand(HandInput handinput) { _LCursor.IsOpen = !handinput.isLeftGrip; _LCursor.IsHovering = true; _LCursor.IsPressed = false; _LCursor.PressExtent = handinput._LPressExtent; double LeftadjustedPressExtent = _LCursor.PressExtent; double LeftfinalRadius = HandCursor.ArtworkSize * (1.0 - (LeftadjustedPressExtent * ((HandCursor.MaximumCursorScale - HandCursor.MinimumCursorScale) / 2.0))); // Flip hand for Left double LeftscaleX = -LeftfinalRadius / HandCursor.ArtworkSize; double LeftscaleY = LeftfinalRadius / HandCursor.ArtworkSize; var LefthandScale = new ScaleTransform(LeftscaleX, LeftscaleY); _LCursor.RenderTransform = LefthandScale; _LCursor.Opacity = 0.5; _RCursor.IsOpen = !handinput.isRightGrip; _RCursor.IsHovering = true; _RCursor.IsPressed = false; _RCursor.PressExtent = handinput._RPressExtent; _RCursor.Opacity = 0.5; Canvas.SetLeft(_LCursor, handinput._dx); Canvas.SetTop(_LCursor, handinput._dy); Canvas.SetLeft(_RCursor, handinput._dx1); Canvas.SetTop(_RCursor, handinput._dy1); }
private void RightHand(HandInput handinput) { _RCursor.IsOpen = !handinput.isRightGrip; _RCursor.IsHovering = true; _RCursor.IsPressed = false; _RCursor.PressExtent = handinput._RPressExtent; _RCursor.Opacity = 0.5; Canvas.SetLeft(_RCursor, handinput._dx1); Canvas.SetTop(_RCursor, handinput._dy1); }
public void UpdateHandCursor(HandInput handinput) { if (handinput == null) { return; } #region (Cursor in Canvas?) switch (handinput._isWhich) { case 0: if (this.Children.Contains(_LCursor)) { this.Children.Remove(_LCursor); } if (this.Children.Contains(_RCursor)) { this.Children.Remove(_RCursor); } return; case 1: if (!this.Children.Contains(_LCursor)) { this.Children.Add(_LCursor); } if (this.Children.Contains(_RCursor)) { this.Children.Remove(_RCursor); } LeftHand(handinput); break; case 2: if (this.Children.Contains(_LCursor)) { this.Children.Remove(_LCursor); } if (!this.Children.Contains(_RCursor)) { this.Children.Add(_RCursor); } RightHand(handinput); break; case 3: if (!this.Children.Contains(_LCursor)) { this.Children.Add(_LCursor); } if (!this.Children.Contains(_RCursor)) { this.Children.Add(_RCursor); } LeftHand(handinput); RightHand(handinput); break; default: return; } #endregion }