public MinimapPresenter() { _annotations = new ObservableCollection<Annotation>(); _layerPresenters = new Dictionary<Guid, LevelLayerPresenter>(); _boxAnnot = new SelectionAnnot() { Outline = _boxOutline, OutlineGlow = _boxOutlineGlow, }; _annotations.Add(_boxAnnot); }
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); }
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); }
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); }
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); }
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); }
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; }
public SelectionAnnotRenderer(SelectionAnnot data) : base(data) { _data = data; }
private void TileSelected(object sender, TileEventArgs e) { _selectedTile = e.Tile; _annotations.Clear(); if (_selectedTile != null) { TileCoord location = _tileLayer.TileToCoord(e.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); }
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); }