Ejemplo n.º 1
0
        public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
        {
            var selectedItem = RootSelection;

            ActiveSelectedItem = selectedItem;

            if (mouseEvent3D.MouseEvent2D.Button == MouseButtons.Left &&
                mouseEvent3D.info != null &&
                selectedItem != null)
            {
                HadClickOnControl = true;

                yValueDisplayInfo.Visible = true;
                xValueDisplayInfo.Visible = true;

                hitPlane            = new PlaneShape(Vector3.UnitZ, mouseEvent3D.info.HitPosition.Z, null);
                originalPointToMove = GetCornerPosition(selectedItem, quadrantIndex);

                initialHitPosition      = mouseEvent3D.info.HitPosition;
                transformOnMouseDown    = transformAppliedByThis = selectedItem.Matrix;
                mouseDownSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
            }

            base.OnMouseDown(mouseEvent3D);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public override void OnMouseUp(MouseEventArgs mouseEvent)
        {
            Invalidate();

            if (SuppressUiVolumes)
            {
                return;
            }

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

            if (MouseDownOnInteractionVolume && mouseDownIAVolume != null)
            {
                mouseDownIAVolume.OnMouseUp(mouseEvent3D);
                SelectedInteractionVolume = null;

                mouseDownIAVolume = null;
            }
            else
            {
                mouseDownIAVolume = null;

                if (anyInteractionVolumeHit)
                {
                    iaVolume.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);
        }
Ejemplo n.º 5
0
 public override void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
 {
     if (HadClickOnControl)
     {
         InteractionContext.Scene.AddTransformSnapshot(transformOnMouseDown);
     }
     base.OnMouseUp(mouseEvent3D);
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
        {
            var selectedItem = RootSelection;

            ActiveSelectedItem = selectedItem;
            if (MouseOver)
            {
                zHeightDisplayInfo.Visible = true;
            }
            else if (!HadClickOnControl)
            {
                zHeightDisplayInfo.Visible = false;
            }

            if (MouseDownOnControl)
            {
                IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);

                if (info != null &&
                    selectedItem != null)
                {
                    var delta = info.HitPosition.Z - initialHitPosition.Z;

                    double newZPosition = mouseDownSelectedBounds.MinXYZ.Z + delta;

                    if (InteractionContext.SnapGridDistance > 0)
                    {
                        // snap this position to the grid
                        double snapGridDistance = InteractionContext.SnapGridDistance;

                        // snap this position to the grid
                        newZPosition = ((int)((newZPosition / snapGridDistance) + .5)) * snapGridDistance;
                    }

                    AxisAlignedBoundingBox originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
                    var moveAmount = newZPosition - originalSelectedBounds.MinXYZ.Z;

                    if (moveAmount != 0)
                    {
                        selectedItem.Matrix = selectedItem.Matrix * Matrix4X4.CreateTranslation(0, 0, moveAmount);
                        Invalidate();
                    }
                }
            }

            base.OnMouseMove(mouseEvent3D);
        }
Ejemplo n.º 8
0
        public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
        {
            InteractionContext.Scene.DrawSelection = false;

            IObject3D selectedItem = RootSelection;

            if (mouseEvent3D.info != null && selectedItem != null)
            {
                SelectedItemOnMouseDown = selectedItem;

                angleTextControl.Visible = true;

                var selectedObject = SelectedItemOnMouseDown;
                AxisAlignedBoundingBox currentSelectedBounds = selectedObject.GetAxisAlignedBoundingBox(Matrix4X4.Identity);

                var     selectedObjectRotationCenter = currentSelectedBounds.Center;
                Vector3 cornerForAxis = GetCornerPosition(selectedObject);
                // move the rotation center to the correct side of the bounding box
                selectedObjectRotationCenter[RotationAxis] = cornerForAxis[RotationAxis];

                mouseDownInfo = new Mouse3DInfo(
                    mouseEvent3D.info.HitPosition,
                    selectedObject.Matrix,
                    selectedObjectRotationCenter,
                    GetControlCenter(selectedObject),
                    RotationAxis
                    );

                // Get move data updated
                lastSnappedRotation  = 0;
                SnappedRotationAngle = 0;
                rotatingCW           = true;
                mouseMoveInfo        = mouseDownInfo;
                InteractionContext.Scene.ShowSelectionShadow = false;

                mouseMoveInfo = new Mouse3DInfo(
                    mouseEvent3D.info.HitPosition,
                    selectedObject.Matrix,
                    selectedObjectRotationCenter,
                    GetControlCenter(selectedObject),
                    RotationAxis
                    );
            }

            base.OnMouseDown(mouseEvent3D);
        }
Ejemplo n.º 9
0
        public override void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
        {
            InteractionContext.Scene.DrawSelection = true;
            // if we rotated it
            if (mouseDownInfo != null)
            {
                // put in the start transform so we can go back to it if we have to
                InteractionContext.Scene.AddTransformSnapshot(mouseDownInfo.SelectedObjectTransform);
            }

            if (mouseDownInfo != null)
            {
                InteractionContext.Scene.ShowSelectionShadow = true;
            }

            base.OnMouseUp(mouseEvent3D);
        }
Ejemplo n.º 10
0
        public override void OnMouseMove(MouseEventArgs mouseEvent)
        {
            base.OnMouseMove(mouseEvent);

            if (SuppressUiVolumes ||
                !this.PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y))
            {
                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);
                }
            }
        }
Ejemplo n.º 11
0
        public override void OnMouseMove(MouseEventArgs mouseEvent)
        {
            base.OnMouseMove(mouseEvent);

            if (SuppressUiVolumes ||
                !this.PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y))
            {
                return;
            }

            Ray           ray          = this.World.GetRayForLocalBounds(mouseEvent.Position);
            IntersectInfo info         = null;
            var           mouseEvent3D = new MouseEvent3DArgs(mouseEvent, ray, info);

            if (MouseDownOnInteractionVolume && mouseDownIAVolume != null)
            {
                mouseDownIAVolume.OnMouseMove(mouseEvent3D);
            }
            else
            {
                this.FindInteractionVolumeHit(ray, out InteractionVolume hitIAVolume, out info);

                var iaVolumes = this.InteractionVolumes;

                foreach (var iaVolume in iaVolumes)
                {
                    if (hitIAVolume == iaVolume)
                    {
                        iaVolume.MouseOver       = true;
                        iaVolume.MouseMoveInfo   = info;
                        HoveredInteractionVolume = iaVolume;
                    }
                    else
                    {
                        iaVolume.MouseOver     = false;
                        iaVolume.MouseMoveInfo = null;
                    }

                    // TODO: Why do non-hit volumes get mouse move?
                    iaVolume.OnMouseMove(mouseEvent3D);
                }
            }
        }
Ejemplo n.º 12
0
        public override void OnMouseDown(MouseEventArgs mouseEvent)
        {
            base.OnMouseDown(mouseEvent);

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

            if (this.Scene.HasSelection &&
                !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;
            }
        }
Ejemplo n.º 13
0
        public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
        {
            if (mouseEvent3D.info != null && InteractionContext.Scene.SelectedItem != null)
            {
                HadClickOnControl  = true;
                ActiveSelectedItem = RootSelection;

                zValueDisplayInfo.Visible = true;

                var selectedItem = ActiveSelectedItem;

                double distanceToHit = Vector3Ex.Dot(mouseEvent3D.info.HitPosition, mouseEvent3D.MouseRay.directionNormal);
                hitPlane            = new PlaneShape(mouseEvent3D.MouseRay.directionNormal, distanceToHit, null);
                originalPointToMove = GetTopPosition(selectedItem);

                initialHitPosition      = mouseEvent3D.info.HitPosition;
                transformOnMouseDown    = selectedItem.Matrix;
                mouseDownSelectedBounds = selectedItem.GetAxisAlignedBoundingBox(Matrix4X4.Identity);
            }

            base.OnMouseDown(mouseEvent3D);
        }
Ejemplo n.º 14
0
        public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D)
        {
            var selectedItem = RootSelection;

            if (mouseEvent3D.info != null &&
                selectedItem != null)
            {
                HadClickOnControl  = true;
                ActiveSelectedItem = selectedItem;

                zHeightDisplayInfo.Visible = true;

                double distanceToHit = Vector3Ex.Dot(mouseEvent3D.info.HitPosition, mouseEvent3D.MouseRay.directionNormal);
                hitPlane = new PlaneShape(mouseEvent3D.MouseRay.directionNormal, distanceToHit, null);

                initialHitPosition      = mouseEvent3D.info.HitPosition;
                transformOnMouseDown    = selectedItem.Matrix;
                mouseDownSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
            }

            base.OnMouseDown(mouseEvent3D);
        }
Ejemplo n.º 15
0
        public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
        {
            var selectedItem = RootSelection;

            ActiveSelectedItem = selectedItem;
            if (MouseOver)
            {
                zValueDisplayInfo.Visible = true;
            }
            else if (!HadClickOnControl)
            {
                zValueDisplayInfo.Visible = false;
            }

            if (MouseDownOnControl)
            {
                IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);

                if (info != null &&
                    selectedItem != null)
                {
                    AxisAlignedBoundingBox originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox(Matrix4X4.Identity);

                    Vector3 delta = info.HitPosition - initialHitPosition;

                    Vector3 newPosition = originalPointToMove + delta;

                    if (InteractionContext.SnapGridDistance > 0)
                    {
                        // snap this position to the grid
                        double snapGridDistance = InteractionContext.SnapGridDistance;

                        // snap this position to the grid
                        newPosition.Z = ((int)((newPosition.Z / snapGridDistance) + .5)) * snapGridDistance;
                    }

                    Vector3 topPosition  = GetTopPosition(selectedItem);
                    Vector3 lockedBottom = new Vector3(topPosition.X, topPosition.Y, originalSelectedBounds.MinXYZ.Z);

                    Vector3 newSize = Vector3.Zero;
                    newSize.Z = newPosition.Z - lockedBottom.Z;

                    // scale it
                    Vector3 scaleAmount = ScaleCornerControl.GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, InteractionContext.GuiSurface.ModifierKeys);

                    Matrix4X4 scale = Matrix4X4.CreateScale(scaleAmount);

                    selectedItem.Matrix = selectedItem.ApplyAtBoundsCenter(scale);

                    // and keep the locked edge in place
                    AxisAlignedBoundingBox scaledSelectedBounds = selectedItem.GetAxisAlignedBoundingBox(Matrix4X4.Identity);
                    Vector3 newLockedBottom = new Vector3(topPosition.X, topPosition.Y, scaledSelectedBounds.MinXYZ.Z);

                    selectedItem.Matrix *= Matrix4X4.CreateTranslation(lockedBottom - newLockedBottom);

                    Invalidate();
                }
            }

            base.OnMouseMove(mouseEvent3D);
        }
Ejemplo n.º 16
0
        public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
        {
            var selectedItem = RootSelection;

            ActiveSelectedItem = selectedItem;

            if (MouseOver)
            {
                xValueDisplayInfo.Visible = true;
                yValueDisplayInfo.Visible = true;
            }
            else if (!HadClickOnControl ||
                     (selectedItem != null && selectedItem.Matrix != transformAppliedByThis))
            {
                xValueDisplayInfo.Visible = false;
                yValueDisplayInfo.Visible = false;
            }

            if (MouseDownOnControl)
            {
                IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);

                if (info != null &&
                    selectedItem != null)
                {
                    AxisAlignedBoundingBox originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();

                    Vector3 delta = info.HitPosition - initialHitPosition;

                    Vector3 newPosition = originalPointToMove + delta;

                    if (InteractionContext.SnapGridDistance > 0)
                    {
                        // snap this position to the grid
                        double snapGridDistance = InteractionContext.SnapGridDistance;

                        // snap this position to the grid
                        newPosition.X = ((int)((newPosition.X / snapGridDistance) + .5)) * snapGridDistance;
                        newPosition.Y = ((int)((newPosition.Y / snapGridDistance) + .5)) * snapGridDistance;
                    }

                    Vector3 cornerPosition    = GetCornerPosition(selectedItem, quadrantIndex);
                    Vector3 cornerPositionCcw = GetCornerPosition(selectedItem, (quadrantIndex + 1) % 4);
                    Vector3 lockedCorner      = GetCornerPosition(selectedItem, (quadrantIndex + 2) % 4);
                    Vector3 cornerPositionCw  = GetCornerPosition(selectedItem, (quadrantIndex + 3) % 4);

                    Vector3 otherSideDelta = GetDeltaToOtherSideXy(selectedItem, quadrantIndex);

                    Vector3 newSize = Vector3.Zero;
                    newSize.X = lockedCorner.X - newPosition.X;
                    if (quadrantIndex == 0 || quadrantIndex == 3)
                    {
                        newSize.X *= -1;
                    }
                    newSize.Y = lockedCorner.Y - newPosition.Y;
                    if (quadrantIndex == 0 || quadrantIndex == 1)
                    {
                        newSize.Y *= -1;
                    }

                    Vector3 scaleAmount = GetScalingConsideringShiftKey(originalSelectedBounds, mouseDownSelectedBounds, newSize, InteractionContext.GuiSurface.ModifierKeys);

                    // scale it
                    Matrix4X4 scale = Matrix4X4.CreateScale(scaleAmount);

                    selectedItem.Matrix = selectedItem.ApplyAtBoundsCenter(scale);

                    // and keep the locked edge in place
                    Vector3 newLockedCorner = GetCornerPosition(selectedItem, (quadrantIndex + 2) % 4);

                    AxisAlignedBoundingBox postScaleBounds = selectedItem.GetAxisAlignedBoundingBox();
                    newLockedCorner.Z = 0;
                    lockedCorner.Z    = mouseDownSelectedBounds.MinXYZ.Z - postScaleBounds.MinXYZ.Z;

                    selectedItem.Matrix *= Matrix4X4.CreateTranslation(lockedCorner - newLockedCorner);

                    Invalidate();
                }
            }

            if (selectedItem != null)
            {
                transformAppliedByThis = selectedItem.Matrix;
            }

            base.OnMouseMove(mouseEvent3D);
        }
Ejemplo n.º 17
0
        public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D)
        {
            IObject3D selectedItem = RootSelection;

            if (selectedItem != null)
            {
                var controlCenter = GetControlCenter(selectedItem);
                if (mouseDownInfo != null)
                {
                    controlCenter = mouseDownInfo.ControlCenter;
                }
                var           hitPlane           = new PlaneShape(RotationPlanNormal, Vector3Ex.Dot(RotationPlanNormal, controlCenter), null);
                IntersectInfo hitOnRotationPlane = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
                if (hitOnRotationPlane != null)
                {
                    AxisAlignedBoundingBox currentSelectedBounds = selectedItem.GetAxisAlignedBoundingBox(Matrix4X4.Identity);
                    var selectedObjectRotationCenter             = currentSelectedBounds.Center;
                    if (mouseDownInfo != null)
                    {
                        selectedObjectRotationCenter = mouseDownInfo.SelectedObjectRotationCenter;
                    }

                    Vector3 cornerForAxis = GetCornerPosition(selectedItem);
                    // move the rotation center to the correct side of the bounding box
                    selectedObjectRotationCenter[RotationAxis] = cornerForAxis[RotationAxis];

                    mouseMoveInfo = new Mouse3DInfo(
                        hitOnRotationPlane.HitPosition,
                        selectedItem.Matrix,
                        selectedObjectRotationCenter,
                        controlCenter,
                        RotationAxis
                        );

                    if (MouseDownOnControl &&
                        mouseDownInfo != null)
                    {
                        double rawDeltaRotationAngle = mouseMoveInfo.AngleOfHit - mouseDownInfo.AngleOfHit;
                        double snapRadians           = MathHelper.DegreesToRadians(1);

                        // snap this position to the grid
                        if (rawDeltaRotationAngle > 0)
                        {
                            SnappedRotationAngle = ((int)((rawDeltaRotationAngle / snapRadians) + .5)) * snapRadians;
                        }
                        else
                        {
                            SnappedRotationAngle = ((int)((rawDeltaRotationAngle / snapRadians) - .5)) * snapRadians;
                        }

                        int snappingIndex = GetSnapIndex(selectedItem, numSnapPoints);
                        if (snappingIndex != -1)
                        {
                            SnappedRotationAngle = snappingIndex * MathHelper.Tau / numSnapPoints;
                        }
                        else if (InteractionContext.GuiSurface.ModifierKeys == Keys.Shift)
                        {
                            snapRadians = MathHelper.DegreesToRadians(45);

                            if (rawDeltaRotationAngle > 0)
                            {
                                SnappedRotationAngle = ((int)((rawDeltaRotationAngle / snapRadians) + .5)) * snapRadians;
                            }
                            else
                            {
                                SnappedRotationAngle = ((int)((rawDeltaRotationAngle / snapRadians) - .5)) * snapRadians;
                            }
                        }

                        if (SnappedRotationAngle < 0)
                        {
                            SnappedRotationAngle += MathHelper.Tau;
                        }

                        // check if this move crosses zero degrees
                        if (lastSnappedRotation == 0 && SnappedRotationAngle != 0)
                        {
                            rotatingCW = DeltaAngle(0, SnappedRotationAngle) < 0;
                        }
                        else if ((DeltaAngle(0, SnappedRotationAngle) < 0 &&
                                  DeltaAngle(0, lastSnappedRotation) > 0 &&
                                  Math.Abs(DeltaAngle(0, lastSnappedRotation)) < 1) ||
                                 (DeltaAngle(0, SnappedRotationAngle) > 0 &&
                                  DeltaAngle(0, lastSnappedRotation) < 0 &&
                                  Math.Abs(DeltaAngle(0, lastSnappedRotation)) < 1))
                        {
                            // let's figure out which way we are going
                            rotatingCW = (DeltaAngle(0, SnappedRotationAngle) < 0 && DeltaAngle(0, lastSnappedRotation) > 0);
                        }

                        // undo the last rotation
                        RotateAroundAxis(selectedItem, -lastSnappedRotation);

                        // rotate it
                        RotateAroundAxis(selectedItem, SnappedRotationAngle);

                        lastSnappedRotation = SnappedRotationAngle;

                        Invalidate();
                    }
                }
            }

            base.OnMouseMove(mouseEvent3D);
        }
Ejemplo n.º 18
0
 public override void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
 {
     view3DWidget.AddUndoForSelectedMeshGroupTransform(transformOnMouseDown);
     base.OnMouseUp(mouseEvent3D);
 }
Ejemplo n.º 19
0
 public override void OnMouseUp(MouseEvent3DArgs mouseEvent3D)
 {
     InteractionContext.AddTransformSnapshot(transformOnMouseDown);
     base.OnMouseUp(mouseEvent3D);
 }