Esempio n. 1
0
        public void MouseUp()
        {
            var selected    = Manipulator.Selected;
            var addedLevels = 0;

            if (ChangedPositionOfSelected() && ChangedSizeOfSelected())
            {
                for (var i = 0; i < selected.Figures.Count; i++)
                {
                    var figure      = selected.Figures[i];
                    var startFigure = figuresStartProperties[i];
                    undoRedo.InsertInUnDoRedoForMove(figure, figure.getX - startFigure.getX, figure.getY - startFigure.getY);
                    undoRedo.InsertInUnDoRedoForResize(figure, figure.getWidth - startFigure.getWidth, figure.getHeight - startFigure.getHeight);
                    addedLevels += 2;
                    redoLevels.Clear();
                }
                undoLevels.Push(addedLevels);
            }
            else
            {
                if (ChangedPositionOfSelected())
                {
                    for (var i = 0; i < selected.Figures.Count; i++)
                    {
                        var figure      = selected.Figures[i];
                        var startFigure = figuresStartProperties[i];
                        undoRedo.InsertInUnDoRedoForMove(figure, figure.getX - startFigure.getX, figure.getY - startFigure.getY);
                        addedLevels += 1;
                        redoLevels.Clear();
                    }
                    undoLevels.Push(addedLevels);
                }
                else if (ChangedSizeOfSelected())
                {
                    for (var i = 0; i < selected.Figures.Count; i++)
                    {
                        var figure      = selected.Figures[i];
                        var startFigure = figuresStartProperties[i];
                        undoRedo.InsertInUnDoRedoForResize(figure, figure.getWidth - startFigure.getWidth, figure.getHeight - startFigure.getHeight);
                        addedLevels += 1;
                        redoLevels.Clear();
                    }
                    undoLevels.Push(addedLevels);
                }
            }


            mouseDown = false;
        }