public Chunk GetSelected(int x, int y) { for (int i = this.Chunks.Count - 1; i >= 0; i--) { Chunk chunk = this.Chunks[i]; if (chunk.IsPalette()) { continue; } if (chunk.IsBackground()) { continue; } SxzPoint boundingBox = new SxzPoint(0, 0); SxzPoint origin = chunk.Origin; chunk.EnsureDimensions(boundingBox); if (x >= origin.X && y >= origin.Y && x < (boundingBox.X) && y < (boundingBox.Y)) { if (chunk.GetColor(x, y) != null) { return(chunk); } } } return(null); }
public void EnsureDimensions(SxzPoint boundingBox) { foreach (Chunk chunk in Chunks) { chunk.EnsureDimensions(boundingBox); } }