Esempio n. 1
0
        private static void UpdateDrag(ref PCad.InteractionState interactionState, ref SketchModel sketchModel)
        {
            var(value, pointsInNegativeDirection) = CoordinateManipulation.UpdateDrag(
                interactionState.draggedCoordinate,
                sketchModel.coordinateSystem.AxisThatContainsCoordinate(interactionState.draggedCoordinate));

            interactionState.draggedCoordinate.Parameter.Value = value;
            //quick fix: for now, only mue coordinates can be dragged
            ((Mue)interactionState.draggedCoordinate).PointsInNegativeDirection =
                pointsInNegativeDirection;
        }
Esempio n. 2
0
        public static void CleanUpIncompleteGeometry(ref PCad.InteractionState interactionState,
                                                     ref SketchModel sketchModel)
        {
            if (interactionState.incompleteGeometry == null)
            {
                return;
            }

            var incompleteGeometry = interactionState.incompleteGeometry;

            interactionState.incompleteGeometry.P0.ForEach(c =>
                                                           c.UnregisterGeometryAndTryToDelete(incompleteGeometry));

            sketchModel.geometries.Remove(interactionState.incompleteGeometry);
            interactionState.incompleteGeometry = null;
        }
Esempio n. 3
0
        public static void Update(ref PCad.InteractionState interactionState, ref SketchModel sketchModel,
                                  CoordinateSystemUI coordinateSystemUI, bool isMouseOnDrawArea, Action saveToHistory)

        {
            UpdateHoveredCoordinate(ref interactionState, coordinateSystemUI);

            switch (interactionState.CurrentMouseState)
            {
            case MouseInput.MouseState.None:
            case MouseInput.MouseState.SetAnchorDown:
            case MouseInput.MouseState.DeleteDown:
                break;

            case MouseInput.MouseState.PrimaryDown:
                if (interactionState.hoveredCoordinate.HasValue && isMouseOnDrawArea)
                {
                    StartDrag(ref interactionState, coordinateSystemUI);
                }
                break;

            case MouseInput.MouseState.PrimaryHold:
                if (interactionState.draggedCoordinate != null)
                {
                    UpdateDrag(ref interactionState, ref sketchModel);
                }
                break;

            case MouseInput.MouseState.PrimaryUp:
                if (interactionState.draggedCoordinate != null)
                {
                    saveToHistory();
                    interactionState.draggedCoordinate = null;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }