public void DragOver(Point point, ushort value) { SelectedTiles.Clear(); SelectedTilesValue.Clear(); point = new Point(point.X / TILE_SIZE, point.Y / TILE_SIZE); SelectedTiles.Add(point); SelectedTilesValue[point] = value; }
public void TempSelection(Rectangle area, bool deselectIfSelected) { TempSelectionTiles.Clear(); TempSelectionDeselect = deselectIfSelected; for (int y = Math.Max(area.Y / TILE_SIZE, 0); y < Math.Min(DivideRoundUp(area.Y + area.Height, TILE_SIZE), Layer.Height); ++y) { for (int x = Math.Max(area.X / TILE_SIZE, 0); x < Math.Min(DivideRoundUp(area.X + area.Width, TILE_SIZE), Layer.Width); ++x) { if (SelectedTiles.Contains(new Point(x, y)) || Layer.Tiles[y][x] != 0xffff) { TempSelectionTiles.Add(new Point(x, y)); } } } }
public void TempSelection(Rectangle area, bool deselectIfSelected) { TempSelectionDeselect = deselectIfSelected; if (tempSelectionArea == Rectangle.Empty) { TempSelectionTiles.Clear(); for (int y = Math.Max(area.Y / TILE_SIZE, 0); y < Math.Min(DivideRoundUp(area.Y + area.Height, TILE_SIZE), Layer.Height); ++y) { for (int x = Math.Max(area.X / TILE_SIZE, 0); x < Math.Min(DivideRoundUp(area.X + area.Width, TILE_SIZE), Layer.Width); ++x) { if (SelectedTiles.Contains(new Point(x, y)) || Layer.Tiles[y][x] != 0xffff) { TempSelectionTiles.Add(new Point(x, y)); } } } } else { Rectangle commonArea = area; commonArea.Intersect(tempSelectionArea); AddToTempSelection(new Rectangle(area.Left, area.Top, area.Width, Math.Max(commonArea.Top - area.Top, 0))); AddToTempSelection(new Rectangle(commonArea.Right, commonArea.Top, Math.Max(area.Right - commonArea.Right, 0), commonArea.Height)); AddToTempSelection(new Rectangle(area.Left, commonArea.Top, Math.Max(commonArea.Left - area.Left, 0), commonArea.Height)); AddToTempSelection(new Rectangle(area.Left, commonArea.Bottom, area.Width, Math.Max(area.Bottom - commonArea.Bottom, 0))); RemoveFromTempSelection(new Rectangle(tempSelectionArea.Left, tempSelectionArea.Top, tempSelectionArea.Width, Math.Max(commonArea.Top - tempSelectionArea.Top, 0)), area); RemoveFromTempSelection(new Rectangle(commonArea.Right, commonArea.Top, Math.Max(tempSelectionArea.Right - commonArea.Right, 0), commonArea.Height), area); RemoveFromTempSelection(new Rectangle(tempSelectionArea.Left, commonArea.Top, Math.Max(commonArea.Left - tempSelectionArea.Left, 0), commonArea.Height), area); RemoveFromTempSelection(new Rectangle(tempSelectionArea.Left, commonArea.Bottom, tempSelectionArea.Width, Math.Max(tempSelectionArea.Bottom - commonArea.Bottom, 0)), area); } tempSelectionArea = area; InvalidateSelectedChunks(); }