//Mouse down
        public void OnMouseDown(Vector2 mousePosition, Matrix4X4 screenToLocal, MouseDownType trackType = MouseDownType.Rotation)
        {
            //if (currentTrackingType == MouseDownType.None)
            {
                currentTrackingType = trackType;
                switch (currentTrackingType)
                {
                case MouseDownType.Rotation:
                    mouseDownPosition = mousePosition;
                    break;

                case MouseDownType.Translation:
                    localToScreenTransform       = Matrix4X4.Invert(screenToLocal);
                    lastTranslationMousePosition = mousePosition;
                    break;

                case MouseDownType.Scale:
                    lastScaleMousePosition = mousePosition;
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }
Exemple #2
0
		private void Win_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) {
			mouseDownType = MouseDownType.None;

			if(parentWin == null) {
				return;
			}

			parentWin.ReleaseMouseCapture();
			parentWin.MouseLeftButtonUp -= Win_MouseLeftButtonUp;
			parentWin.MouseMove -= Win_MouseMove;
			parentWin = null;
		}
Exemple #3
0
		private void mouseDownHandler(MouseDownType type) {
			Window win = Window.GetWindow(this);
			if(win == null) {
				return;
			}
			parentWin = win;
			mouseDownType = type;

			downStartPos = startPos;
			downX = (int)Mouse.GetPosition(bdText).X;

			parentWin.MouseLeftButtonUp += Win_MouseLeftButtonUp; ;
			parentWin.MouseMove += Win_MouseMove;
			parentWin.CaptureMouse();
		}
        public void OnMouseUp()
        {
            switch (currentTrackingType)
            {
            case MouseDownType.Rotation:
                break;

            case MouseDownType.Translation:
                //currentTranslationMatrix = Matrix4X4.Identity;
                break;

            case MouseDownType.Scale:
                break;

            default:
                throw new NotImplementedException();
            }
            currentTrackingType = MouseDownType.None;
        }
Exemple #5
0
        public void OnMouseUp()
        {
            switch (currentTrackingType)
            {
            case MouseDownType.Rotation:
                currentRotationMatrix    = currentRotationMatrix * Matrix4X4.CreateRotation(activeRotationQuaternion);
                activeRotationQuaternion = Quaternion.Identity;
                OnTransformChanged(null);
                break;

            case MouseDownType.Translation:
                //currentTranslationMatrix = Matrix4X4.Identity;
                break;

            case MouseDownType.Scale:
                break;

            default:
                throw new NotImplementedException();
            }
            currentTrackingType = MouseDownType.None;
        }
		public void OnMouseUp()
		{
			switch (currentTrackingType)
			{
				case MouseDownType.Rotation:
					currentRotationMatrix = currentRotationMatrix * Matrix4X4.CreateRotation(activeRotationQuaternion);
					activeRotationQuaternion = Quaternion.Identity;
					OnTransformChanged(null);
					break;

				case MouseDownType.Translation:
					//currentTranslationMatrix = Matrix4X4.Identity;
					break;

				case MouseDownType.Scale:
					break;

				default:
					throw new NotImplementedException();
			}
			currentTrackingType = MouseDownType.None;
		}
		//Mouse down
		public void OnMouseDown(Vector2 mousePosition, Matrix4X4 screenToLocal, MouseDownType trackType = MouseDownType.Rotation)
		{
			//if (currentTrackingType == MouseDownType.None)
			{
				localToScreenTransform = Matrix4X4.Invert(screenToLocal);
				currentTrackingType = trackType;
				switch (currentTrackingType)
				{
					case MouseDownType.Rotation:
						MapToSphere(mousePosition, out rotationStart);
						break;

					case MouseDownType.Translation:
						lastTranslationMousePosition = mousePosition;
						break;

					case MouseDownType.Scale:
						lastScaleMousePosition = mousePosition;
						break;

					default:
						throw new NotImplementedException();
				}
			}
		}
 private void pbxRight_MouseDown(object sender, MouseEventArgs e)
 {
     _downType = MouseDownType.Right;
     ProcessChanges();
     tmrDoIt.Enabled = true;
 }
 private void All_MouseUp(object sender, MouseEventArgs e)
 {
     _downType        = MouseDownType.None;
     tmrDoIt.Enabled  = false;
     tmrDoIt.Interval = _defaultTimerInterval;
 }