public AddCommand ( |
||
command | ||
Résultat | void |
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); }
private void ResetSelection(CompoundCommand command) { if (_selectLayer.HasSelection) { if (_selectLayer.TileSelection.Floating) command.AddCommand(new DefloatTileSelectionCommand(Layer, _selectLayer)); command.AddCommand(new DeleteTileSelectionCommand(_selectLayer)); } command.AddCommand(new CreateTileSelectionCommand(_selectLayer)); }
private void DefloatSelection() { if (_selectLayer == null || _selectLayer.TileSelection == null) return; CompoundCommand command = new CompoundCommand(); if (_selectLayer.TileSelection.Floating) command.AddCommand(new DefloatTileSelectionCommand(Layer, _selectLayer)); command.AddCommand(new DeleteTileSelectionCommand(_selectLayer)); History.Execute(command); }