private void ClearAnnot()
 {
     if (Annot != null)
     {
         Tool._annots.Remove(Annot);
         Annot = null;
     }
 }
        public MinimapPresenter()
        {
            _annotations     = new ObservableCollection <Annotation>();
            _layerPresenters = new Dictionary <Guid, LevelLayerPresenter>();

            _boxAnnot = new SelectionAnnot()
            {
                Outline     = _boxOutline,
                OutlineGlow = _boxOutlineGlow,
            };
            _annotations.Add(_boxAnnot);
        }
Beispiel #3
0
        public TileEraseTool(CommandHistory history, MultiTileGridLayer layer, ObservableCollection <Annotation> annots)
            : base(history, layer)
        {
            _annots = annots;

            _previewMarker = new SelectionAnnot(new Point(0, 0))
            {
                Fill = new SolidColorBrush(new Color(192, 0, 0, 128)),
            };

            _annots.Add(_previewMarker);
        }
            public override ToolState StartPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                Band  = new RubberBand(new Point((int)info.X, (int)info.Y));
                Annot = new SelectionAnnot(new Point((int)info.X, (int)info.Y))
                {
                    Fill    = SelectionAnnotFill,
                    Outline = SelectionAnnotOutline,
                };

                Tool._annots.Add(Annot);
                Tool.StartAutoScroll(info, viewport);

                return(this);
            }
Beispiel #5
0
        private void StartDrag(PointerEventInfo info, ILevelGeometry viewport, MergeAction action)
        {
            TileCoord location = TileLocation(info);

            int x = (int)(location.X * Layer.TileWidth);
            int y = (int)(location.Y * Layer.TileHeight);

            _band           = new RubberBand(new Point(location.X, location.Y));
            _selectionAnnot = new SelectionAnnot(new Point((int)info.X, (int)info.Y))
            {
                Fill = new SolidColorBrush(new Color(76, 178, 255, 128)),
            };

            _annots.Add(_selectionAnnot);
            _action      = UpdateAction.Box;
            _mergeAction = action;

            StartAutoScroll(info, viewport);
        }
Beispiel #6
0
        private void ShowPreviewMarker(TileCoord location)
        {
            if (!_previewMarkerVisible)
            {
                if (_previewMarker == null)
                {
                    _previewMarker      = new SelectionAnnot();
                    _previewMarker.Fill = new SolidColorBrush(new Color(192, 0, 0, 128));
                }

                _annots.Add(_previewMarker);
                _previewMarkerVisible = true;
            }

            int x = (int)(location.X * Layer.TileWidth);
            int y = (int)(location.Y * Layer.TileHeight);

            _previewMarker.Start = new Point(x, y);
            _previewMarker.End   = new Point(x + Layer.TileWidth, y + Layer.TileHeight);
        }
Beispiel #7
0
        private void EndDrag(PointerEventInfo info, ILevelGeometry viewport)
        {
            Rectangle selection = ClampSelection(_band.Selection);

            StaticTileBrush anonBrush = new StaticTileBrush("User Selected", Layer.TileWidth, Layer.TileHeight);

            foreach (LocatedTile tile in Layer.TilesAt(_band.Selection))
            {
                anonBrush.AddTile(new TileCoord(tile.X - _band.Selection.Left, tile.Y - _band.Selection.Top), tile.Tile);
            }

            anonBrush.Normalize();

            _activeBrush = anonBrush;

            _annots.Remove(_selectionAnnot);
            _selectionAnnot = null;

            //EndAutoScroll(info, viewport);
        }
Beispiel #8
0
        private void StartDrag(PointerEventInfo info, ILevelGeometry viewport)
        {
            ClearPreviewMarker();
            _activeBrush = null;

            TileCoord location = TileLocation(info);

            int x = (int)(location.X * Layer.TileWidth);
            int y = (int)(location.Y * Layer.TileHeight);

            _band           = new RubberBand(new Point(location.X, location.Y));
            _selectionAnnot = new SelectionAnnot(new Point((int)info.X, (int)info.Y))
            {
                Fill = new SolidColorBrush(new Color(76, 178, 255, 128)),
            };

            _annots.Add(_selectionAnnot);

            //StartAutoScroll(info, viewport);
        }
Beispiel #9
0
        private void StartEraseAreaSequence(PointerEventInfo info, ILevelGeometry viewport)
        {
            HidePreviewMarker();

            TileCoord location = TileLocation(info);

            int x = (int)(location.X * Layer.TileWidth);
            int y = (int)(location.Y * Layer.TileHeight);

            _band      = new RubberBand(new Point(location.X, location.Y));
            _selection = new SelectionAnnot(new Point(x, y))
            {
                Fill = new SolidColorBrush(new Color(192, 0, 0, 128)),
                //Outline = new Pen(new SolidColorBrush(new Color(192, 0, 0, 200))),
            };

            _annots.Add(_selection);
            _inAreaSequence = true;

            StartAutoScroll(info, viewport);
        }
Beispiel #10
0
        public void SelectTile(Tile tile)
        {
            _selectedTile = tile;

            _annotations.Clear();

            if (_selectedTile != null)
            {
                TileCoord location = _tileLayer.TileToCoord(tile);
                int       x        = location.X * _tileSet.TileWidth;
                int       y        = location.Y * _tileSet.TileHeight;

                SelectionAnnot annot = new SelectionAnnot()
                {
                    Start = new Treefrog.Framework.Imaging.Point(x, y),
                    End   = new Treefrog.Framework.Imaging.Point(x + _tileSet.TileWidth, y + _tileSet.TileHeight),
                    Fill  = new SolidColorBrush(new Treefrog.Framework.Imaging.Color(192, 0, 0, 128)),
                };

                _annotations.Add(annot);
            }

            OnSelectedTileChanged(EventArgs.Empty);
        }
Beispiel #11
0
 public SelectionAnnotRenderer(SelectionAnnot data)
     : base(data)
 {
     _data = data;
 }