Пример #1
0
        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();
                    }
                }
            }
        }