예제 #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);
        }
        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
		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);
		}
        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);
                }
            }
        }
        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;
		}