Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        private void StartDrawPathSequence(PointerEventInfo info)
        {
            if (ActiveTile == null && _activeBrush == null)
            {
                return;
            }

            _drawCommand = new TileReplace2DCommand(Layer);
        }
Esempio n. 4
0
 private void StartErasePathSequence(PointerEventInfo info)
 {
     _drawCommand = new TileReplace2DCommand(Layer);
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        private void StartDrawPathSequence(PointerEventInfo info)
        {
            if (ActiveTile == null && _activeBrush == null)
                return;

            _drawCommand = new TileReplace2DCommand(Layer);
        }
Esempio n. 8
0
 private void StartErasePathSequence(PointerEventInfo info)
 {
     _drawCommand = new TileReplace2DCommand(Layer);
 }
Esempio n. 9
0
        public FloatTileSelectionCommand(MultiTileGridLayer source, ITileSelectionLayer selectLayer)
        {
            _tileSource = source;
            _command = new TileReplace2DCommand(source);

            _selectLayer = selectLayer;
        }