public override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); Point2I mousePos = new Point2I(e.X, e.Y); // Sample the tile at the mouse position. BaseTileDataInstance baseTile = null; if (editorControl.EventMode) { baseTile = LevelDisplayControl.SampleEventTile(mousePos); } else { baseTile = LevelDisplayControl.SampleTile(mousePos, editorControl.CurrentLayer); } // Select or deselect the tile. if (e.Button == MouseButtons.Left) { /*if (FormsControl.ModifierKeys == Keys.Control) { * if (baseTile != null) { * // Add or remove tiles from selection. * if (!LevelDisplayControl.IsTileInSelection(baseTile)) { * LevelDisplayControl.AddTileToSelection(baseTile); * EditorControl.PropertyGrid.OpenProperties(baseTile); * } * else { * LevelDisplayControl.RemoveTileFromSelection(baseTile); * } * } * } * else */{ // Select a new tile, deselecting others. LevelDisplayControl.DeselectTiles(); if (baseTile != null) { LevelDisplayControl.AddTileToSelection(baseTile); EditorControl.PropertyGrid.OpenProperties(baseTile); } else { EditorControl.PropertyGrid.CloseProperties(); } } } }
public override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); Point2I mousePos = new Point2I(e.X, e.Y); if (!editorControl.EventMode) { // Highlight tiles. TileDataInstance tile = LevelDisplayControl.SampleTile(mousePos, editorControl.CurrentLayer); EditorControl.HighlightMouseTile = (tile != null); } else { // Highlight event tiles. EventTileDataInstance eventTile = LevelDisplayControl.SampleEventTile(mousePos); EditorControl.HighlightMouseTile = (eventTile != null); } }