private void StartFillSequence(PointerEventInfo info) { if (!SourceValid) { return; } TileCoord location = TileLocation(info); if (!TileInRange(location)) { return; } if (SourceType == TileSourceType.Brush) { Layer.TileAdding += TileAddingHandler; Layer.TileRemoving += TileRemovingHandler; } _fillLayer = Layer; _sourceStack = new TileStack(); _sourceStack.Add(ActiveTile); _fillCommand = new TileReplace2DCommand(Layer); FloodFill(location.X, location.Y); if (SourceType == TileSourceType.Brush) { Layer.TileAdding -= TileAddingHandler; Layer.TileRemoving -= TileRemovingHandler; } History.Execute(_fillCommand); }
private void EndEraseAreaSequence(PointerEventInfo info, ILevelGeometry viewport) { Rectangle selection = _band.Selection; int xmin = Math.Max(Layer.TileOriginX, selection.Left); int ymin = Math.Max(Layer.TileOriginY, selection.Top); int xmax = Math.Min(Layer.TileOriginX + Layer.TilesWide, selection.Right); int ymax = Math.Min(Layer.TileOriginY + Layer.TilesHigh, selection.Bottom); TileReplace2DCommand command = new TileReplace2DCommand(Layer); for (int x = xmin; x < xmax; x++) { for (int y = ymin; y < ymax; y++) { command.QueueReplacement(new TileCoord(x, y), (TileStack)null); Layer[new TileCoord(x, y)] = null; } } History.Execute(command); _annots.Remove(_selection); _inAreaSequence = false; EndAutoScroll(info, viewport); }
private void StartDrawPathSequence(PointerEventInfo info) { if (ActiveTile == null && _activeBrush == null) { return; } _drawCommand = new TileReplace2DCommand(Layer); }
private void StartErasePathSequence(PointerEventInfo info) { _drawCommand = new TileReplace2DCommand(Layer); }
private void EndEraseAreaSequence(PointerEventInfo info, ILevelGeometry viewport) { Rectangle selection = _band.Selection; int xmin = Math.Max(Layer.TileOriginX, selection.Left); int ymin = Math.Max(Layer.TileOriginY, selection.Top); int xmax = Math.Min(Layer.TileOriginX + Layer.TilesWide, selection.Right); int ymax = Math.Min(Layer.TileOriginY + Layer.TilesHigh, selection.Bottom); TileReplace2DCommand command = new TileReplace2DCommand(Layer); for (int x = xmin; x < xmax; x++) { for (int y = ymin; y < ymax; y++) { command.QueueReplacement(new TileCoord(x, y), (TileStack)null); Layer[new TileCoord(x, y)] = null; } } History.Execute(command); _annots.Remove(_selection); _inAreaSequence = false; EndAutoScroll(info, viewport); }
private void StartFillSequence(PointerEventInfo info) { if (!SourceValid) return; TileCoord location = TileLocation(info); if (!TileInRange(location)) return; if (SourceType == TileSourceType.Brush) { Layer.TileAdding += TileAddingHandler; Layer.TileRemoving += TileRemovingHandler; } _fillLayer = Layer; _sourceStack = new TileStack(); _sourceStack.Add(ActiveTile); _fillCommand = new TileReplace2DCommand(Layer); FloodFill(location.X, location.Y); if (SourceType == TileSourceType.Brush) { Layer.TileAdding -= TileAddingHandler; Layer.TileRemoving -= TileRemovingHandler; } History.Execute(_fillCommand); }
private void StartDrawPathSequence(PointerEventInfo info) { if (ActiveTile == null && _activeBrush == null) return; _drawCommand = new TileReplace2DCommand(Layer); }
private void StartErasePathSequence(PointerEventInfo info) { _drawCommand = new TileReplace2DCommand(Layer); }
public FloatTileSelectionCommand(MultiTileGridLayer source, ITileSelectionLayer selectLayer) { _tileSource = source; _command = new TileReplace2DCommand(source); _selectLayer = selectLayer; }