Exemple #1
0
 public void Engulf(AyahBounds other)
 {
     if (MinX > other.MinX)
         MinX = other.MinX;
     if (MinY > other.MinY)
         MinY = other.MinY;
     if (MaxX < other.MaxX)
         MaxX = other.MaxX;
     if (MaxY < other.MaxY)
         MaxY = other.MaxY;
 }
Exemple #2
0
 public void Engulf(AyahBounds other)
 {
     if (MinX > other.MinX)
     {
         MinX = other.MinX;
     }
     if (MinY > other.MinY)
     {
         MinY = other.MinY;
     }
     if (MaxX < other.MaxX)
     {
         MaxX = other.MaxX;
     }
     if (MaxY < other.MaxY)
     {
         MaxY = other.MaxY;
     }
 }
        private IList<AyahBounds> doHighlightAyah(AyahBounds first, AyahBounds last, Dictionary<int, AyahBounds> lineCoordinates)
        {
            if (first == null) 
                return null;

            var rangesToDraw = new List<AyahBounds>();
            if (last == null)
            {
                rangesToDraw.Add(first);
            }
            else
            {
                if (first.Line == last.Line)
                {
                    first.Engulf(last);
                    rangesToDraw.Add(first);
                }
                else
                {
                    AyahBounds b = lineCoordinates[first.Line];
                    rangesToDraw.Add(b);

                    int currentLine = first.Line + 1;
                    int diff = last.Line - first.Line - 1;
                    for (int i = 0; i < diff; i++)
                    {
                        b = lineCoordinates[currentLine + i];
                        rangesToDraw.Add(b);
                    }

                    b = lineCoordinates[last.Line];
                    rangesToDraw.Add(b);
                }
            }
            return rangesToDraw;
        }