public override void AddingAtPosition(int x, int y, TileMaskCollection selection)
        {
            if (selection == null)
            {
                return;
            }

            selection.MoveTo(x, y);

            int drx = selection.Left;
            int dry = selection.Top;
            int drr = drx + selection.Width;
            int drb = dry + selection.Height;
            int cz  = CellSize;

            drx /= cz;
            drx *= cz;
            dry /= cz;
            dry *= cz;
            drr += (drr % cz);
            drb += (drb % cz);
            int w = drr - drx;
            int h = drb - dry;

            layer1.DrawRectangle(drx, dry, w, h, BackgroundColor);
            layers[SelectedLayer].AddTiles(selection);

            ITileCollection col = layers[SelectedLayer].TilesOnArea(drx, dry, w, h);

            drawTileMaskCollection(col);
            UpdateLayer2();
            updateOffsetAndCopyLenght(drx, dry, drr, drb);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves the tiles.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <returns>A bool.</returns>
        public bool MoveTiles(int x, int y)
        {
            if (selection == null)
            {
                return(false);
            }
            TileMaskCollection sel = selection;

            RemoveTiles();
            sel.MoveTo(x, y);
            AddTiles(sel);
            selection = sel;
            return(true);
        }
        /// <summary>
        /// Moves the selection.
        /// </summary>
        /// <param name="newX">The new x.</param>
        /// <param name="newY">The new y.</param>
        public bool MoveSelection(int newX, int newY)
        {
            if (selection == null)
            {
                selection = new TileMaskCollection(BytesPerColor);
            }
            if (selection.Left == newX && selection.Top == newY)
            {
                return(false);
            }
            bool b = selection.MoveTo(newX, newY);

            UpdateContainer();
            RequireRefresh = true;
            OnSelectionChanged?.Invoke(this, selection);
            return(b);
        }