コード例 #1
0
        public override void OnMouseUp(MouseEventArgs mouseEvent)
        {
            trackballTumbleWidget.DrawRotationHelperCircle = false;
            Invalidate();

            int              volumeHitIndex;
            Ray              ray = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
            IntersectInfo    info;
            bool             anyInteractionVolumeHit = FindInteractionVolumeHit(ray, out volumeHitIndex, out info);
            MouseEvent3DArgs mouseEvent3D            = new MouseEvent3DArgs(mouseEvent, ray, info);

            if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
            {
                interactionVolumes[volumeIndexWithMouseDown].OnMouseUp(mouseEvent3D);
                SelectedInteractionVolume = null;

                volumeIndexWithMouseDown = -1;
            }
            else
            {
                volumeIndexWithMouseDown = -1;

                if (anyInteractionVolumeHit)
                {
                    interactionVolumes[volumeHitIndex].OnMouseUp(mouseEvent3D);
                }
                SelectedInteractionVolume = null;
            }

            base.OnMouseUp(mouseEvent);
        }
コード例 #2
0
        public override void OnMouseUp(MouseEventArgs mouseEvent)
        {
            Invalidate();

            if (SuppressUiVolumes)
            {
                return;
            }

            int              volumeHitIndex;
            Ray              ray = this.World.GetRayForLocalBounds(mouseEvent.Position);
            IntersectInfo    info;
            bool             anyInteractionVolumeHit = FindInteractionVolumeHit(ray, out volumeHitIndex, out info);
            MouseEvent3DArgs mouseEvent3D            = new MouseEvent3DArgs(mouseEvent, ray, info);

            if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
            {
                interactionVolumes[volumeIndexWithMouseDown].OnMouseUp(mouseEvent3D);
                SelectedInteractionVolume = null;

                volumeIndexWithMouseDown = -1;
            }
            else
            {
                volumeIndexWithMouseDown = -1;

                if (anyInteractionVolumeHit)
                {
                    interactionVolumes[volumeHitIndex].OnMouseUp(mouseEvent3D);
                }
                SelectedInteractionVolume = null;
            }

            base.OnMouseUp(mouseEvent);
        }
コード例 #3
0
        public override void OnMouseDown(MouseEventArgs mouseEvent)
        {
            base.OnMouseDown(mouseEvent);

            if (trackballTumbleWidget.MouseCaptured)
            {
                if (trackballTumbleWidget.TransformState == TrackBallController.MouseDownType.Rotation || mouseEvent.Button == MouseButtons.Right)
                {
                    trackballTumbleWidget.DrawRotationHelperCircle = true;
                }
            }

            int           volumeHitIndex;
            Ray           ray = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
            IntersectInfo info;

            if (FindInteractionVolumeHit(ray, out volumeHitIndex, out info))
            {
                MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
                volumeIndexWithMouseDown = volumeHitIndex;
                interactionVolumes[volumeHitIndex].OnMouseDown(mouseEvent3D);
                SelectedInteractionVolume = interactionVolumes[volumeHitIndex];
            }
            else
            {
                SelectedInteractionVolume = null;
            }
        }
コード例 #4
0
 public virtual void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
 {
     if (mouseEvent3D.MouseEvent2D.Button == MouseButtons.Left)
     {
         MouseDownOnControl = true;
         InteractionContext.GuiSurface.Invalidate();
     }
 }
コード例 #5
0
ファイル: UpArrow3D.cs プロジェクト: rorypond/MatterControl
		public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
		{
			zHitHeight = mouseEvent3D.info.hitPosition.z;
			lastMoveDelta = new Vector3();
			double distanceToHit = Vector3.Dot(mouseEvent3D.info.hitPosition, mouseEvent3D.MouseRay.directionNormal);
			hitPlane = new PlaneShape(mouseEvent3D.MouseRay.directionNormal, distanceToHit, null);

			IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
			zHitHeight = info.hitPosition.z;

			base.OnMouseDown(mouseEvent3D);
		}
コード例 #6
0
        public override void OnMouseMove(MouseEventArgs mouseEvent)
        {
            base.OnMouseMove(mouseEvent);

            if (SuppressUiVolumes)
            {
                return;
            }

            Ray           ray  = this.World.GetRayForLocalBounds(mouseEvent.Position);
            IntersectInfo info = null;

            if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
            {
                MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
                interactionVolumes[volumeIndexWithMouseDown].OnMouseMove(mouseEvent3D);
            }
            else
            {
                MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);

                int volumeHitIndex;
                FindInteractionVolumeHit(ray, out volumeHitIndex, out info);

                for (int i = 0; i < interactionVolumes.Count; i++)
                {
                    if (i == volumeHitIndex)
                    {
                        interactionVolumes[i].MouseOver     = true;
                        interactionVolumes[i].MouseMoveInfo = info;

                        HoveredInteractionVolume = interactionVolumes[i];
                    }
                    else
                    {
                        interactionVolumes[i].MouseOver     = false;
                        interactionVolumes[i].MouseMoveInfo = null;
                    }

                    interactionVolumes[i].OnMouseMove(mouseEvent3D);
                }
            }
        }
コード例 #7
0
        public override void OnMouseDown(MouseEventArgs mouseEvent)
        {
            base.OnMouseDown(mouseEvent);

            int           volumeHitIndex;
            Ray           ray = this.World.GetRayForLocalBounds(mouseEvent.Position);
            IntersectInfo info;

            if (this.Scene.SelectedItem != null &&
                !SuppressUiVolumes &&
                FindInteractionVolumeHit(ray, out volumeHitIndex, out info))
            {
                MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
                volumeIndexWithMouseDown = volumeHitIndex;
                interactionVolumes[volumeHitIndex].OnMouseDown(mouseEvent3D);
                SelectedInteractionVolume = interactionVolumes[volumeHitIndex];
            }
            else
            {
                SelectedInteractionVolume = null;
            }
        }
コード例 #8
0
        public override void OnMouseMove(MouseEventArgs mouseEvent)
        {
            base.OnMouseMove(mouseEvent);

            Ray           ray  = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
            IntersectInfo info = null;

            if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
            {
                MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
                interactionVolumes[volumeIndexWithMouseDown].OnMouseMove(mouseEvent3D);
            }
            else
            {
                int volumeHitIndex;
                if (FindInteractionVolumeHit(ray, out volumeHitIndex, out info))
                {
                    if (volumeIndexWithMouseDown == volumeHitIndex)
                    {
                        MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
                        interactionVolumes[volumeHitIndex].OnMouseMove(mouseEvent3D);
                    }
                }
                for (int i = 0; i < interactionVolumes.Count; i++)
                {
                    if (i == volumeHitIndex)
                    {
                        interactionVolumes[i].MouseOver     = true;
                        interactionVolumes[i].MouseMoveInfo = info;
                    }
                    else
                    {
                        interactionVolumes[i].MouseOver     = false;
                        interactionVolumes[i].MouseMoveInfo = null;
                    }
                }
            }
        }
コード例 #9
0
		public override void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
		{
			view3DWidget.AddUndoForSelectedMeshGroupTransform(transformOnMouseDown);
			base.OnMouseUp(mouseEvent3D);
		}
コード例 #10
0
		public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
		{
			IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);

			if (info != null && MeshViewerToDrawWith.SelectedMeshGroupIndex != -1)
			{
				Vector3 delta = new Vector3(0, 0, info.hitPosition.z - zHitHeight);

				// move it back to where it started
				MeshViewerToDrawWith.SelectedMeshGroupTransform *= Matrix4X4.CreateTranslation(new Vector3(-lastMoveDelta));

				if (MeshViewerToDrawWith.SnapGridDistance > 0)
				{
					// snap this position to the grid
					double snapGridDistance = MeshViewerToDrawWith.SnapGridDistance;
					AxisAlignedBoundingBox selectedBounds = MeshViewerToDrawWith.GetBoundsForSelection();

					// snap the z position
					double bottom = selectedBounds.minXYZ.z + delta.z;
					double snappedBottom = (Math.Round((bottom / snapGridDistance))) * snapGridDistance;
					delta.z = snappedBottom - selectedBounds.minXYZ.z;
				}

				// and move it from there to where we are now
				MeshViewerToDrawWith.SelectedMeshGroupTransform *= Matrix4X4.CreateTranslation(new Vector3(delta));

				lastMoveDelta = delta;

				view3DWidget.PartHasBeenChanged();
				Invalidate();
			}

			base.OnMouseMove(mouseEvent3D);
		}
コード例 #11
0
 public virtual void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
 {
     MouseDownOnControl = false;
 }
コード例 #12
0
 public virtual void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
 {
 }
コード例 #13
0
 public virtual void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
 {
     MouseDownOnControl = true;
 }
コード例 #14
0
		public virtual void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
		{
		}
コード例 #15
0
		public override void OnMouseUp(MouseEventArgs mouseEvent)
		{
			trackballTumbleWidget.DrawRotationHelperCircle = false;
			Invalidate();

			int volumeHitIndex;
			Ray ray = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
			IntersectInfo info;
			bool anyInteractionVolumeHit = FindInteractionVolumeHit(ray, out volumeHitIndex, out info);
			MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);

			if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
			{
				MouseDownOnInteractionVolume = false;
				interactionVolumes[volumeIndexWithMouseDown].OnMouseUp(mouseEvent3D);

				volumeIndexWithMouseDown = -1;
			}
			else
			{
				MouseDownOnInteractionVolume = false;
				volumeIndexWithMouseDown = -1;

				if (anyInteractionVolumeHit)
				{
					interactionVolumes[volumeHitIndex].OnMouseUp(mouseEvent3D);
				}
			}

			base.OnMouseUp(mouseEvent);
		}
コード例 #16
0
		public override void OnMouseMove(MouseEventArgs mouseEvent)
		{
			base.OnMouseMove(mouseEvent);

			Ray ray = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
			IntersectInfo info = null;
			if (MouseDownOnInteractionVolume && volumeIndexWithMouseDown != -1)
			{
				MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
				interactionVolumes[volumeIndexWithMouseDown].OnMouseMove(mouseEvent3D);
			}
			else
			{
				int volumeHitIndex;
				if (FindInteractionVolumeHit(ray, out volumeHitIndex, out info))
				{
					if (volumeIndexWithMouseDown == volumeHitIndex)
					{
						MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
						interactionVolumes[volumeHitIndex].OnMouseMove(mouseEvent3D);
					}
				}
				for (int i = 0; i < interactionVolumes.Count; i++)
				{
					if (i == volumeHitIndex)
					{
						interactionVolumes[i].MouseOver = true;
					}
					else
					{
						interactionVolumes[i].MouseOver = false;
					}
				}
			}
		}
コード例 #17
0
		public override void OnMouseDown(MouseEventArgs mouseEvent)
		{
			base.OnMouseDown(mouseEvent);

			if (trackballTumbleWidget.MouseCaptured)
			{
				if (trackballTumbleWidget.TransformState == TrackBallController.MouseDownType.Rotation || mouseEvent.Button == MouseButtons.Right)
				{
					trackballTumbleWidget.DrawRotationHelperCircle = true;
				}
			}

			int volumeHitIndex;
			Ray ray = trackballTumbleWidget.GetRayFromScreen(mouseEvent.Position);
			IntersectInfo info;
			if (FindInteractionVolumeHit(ray, out volumeHitIndex, out info))
			{
				MouseEvent3DArgs mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);
				volumeIndexWithMouseDown = volumeHitIndex;
				interactionVolumes[volumeHitIndex].OnMouseDown(mouseEvent3D);
				MouseDownOnInteractionVolume = true;
			}
			else
			{
				MouseDownOnInteractionVolume = false;
			}
		}
コード例 #18
0
 public virtual void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
 {
     MouseDownOnControl = true;
     MeshViewerToDrawWith.Invalidate();
 }
コード例 #19
0
		public virtual void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
		{
			MouseDownOnControl = true;
		}
コード例 #20
0
		public virtual void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
		{
			MouseDownOnControl = false;
		}