Exemplo n.º 1
0
        private void EndDrag(PointerEventInfo info, ILevelGeometry viewport)
        {
            Rectangle selection = ClampSelection(_band.Selection);

            CompoundCommand command = new CompoundCommand();

            if (_mergeAction == MergeAction.New || !_selectLayer.HasSelection || _selectLayer.TileSelection.Floating)
            {
                ResetSelection(command);
            }

            switch (_mergeAction)
            {
            case MergeAction.New:
                ModifyNewTileSelectionCommand newCommand = new ModifyNewTileSelectionCommand(_selectLayer);
                newCommand.AddLocations(TileCoordsFromRegion(selection));
                command.AddCommand(newCommand);
                break;

            case MergeAction.Add:
                ModifyAddTileSelectionCommand addCommand = new ModifyAddTileSelectionCommand(_selectLayer);
                addCommand.AddLocations(TileCoordsFromRegion(selection));
                command.AddCommand(addCommand);
                break;

            case MergeAction.Remove:
                ModifyRemoveTileSelectionCommand removeCommand = new ModifyRemoveTileSelectionCommand(_selectLayer);
                removeCommand.AddLocations(TileCoordsFromRegion(selection));
                command.AddCommand(removeCommand);
                break;
            }

            if (command.Count > 0)
            {
                History.Execute(command);
            }

            _annots.Remove(_selectionAnnot);
            _action = UpdateAction.None;

            EndAutoScroll(info, viewport);
        }
Exemplo n.º 2
0
        private void EndDrag(PointerEventInfo info, ILevelGeometry viewport)
        {
            Rectangle selection = ClampSelection(_band.Selection);

            CompoundCommand command = new CompoundCommand();

            if (_mergeAction == MergeAction.New || !_selectLayer.HasSelection || _selectLayer.TileSelection.Floating)
                ResetSelection(command);

            switch (_mergeAction) {
                case MergeAction.New:
                    ModifyNewTileSelectionCommand newCommand = new ModifyNewTileSelectionCommand(_selectLayer);
                    newCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(newCommand);
                    break;
                case MergeAction.Add:
                    ModifyAddTileSelectionCommand addCommand = new ModifyAddTileSelectionCommand(_selectLayer);
                    addCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(addCommand);
                    break;
                case MergeAction.Remove:
                    ModifyRemoveTileSelectionCommand removeCommand = new ModifyRemoveTileSelectionCommand(_selectLayer);
                    removeCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(removeCommand);
                    break;
            }

            if (command.Count > 0)
                History.Execute(command);

            _annots.Remove(_selectionAnnot);
            _action = UpdateAction.None;

            EndAutoScroll(info, viewport);
        }