Пример #1
0
 public Range(Loc start, Loc end, SelectionType type = SelectionType.Normal)
 {
     if (start < end)
     {
         this.start = start;
         this.end = end;
     }
     else
     {
         this.start = end;
         this.end = start;
     }
     this.type = type;
 }
Пример #2
0
 public Range(Loc start, Loc end)
 {
     if (start < end)
     {
         this.startY = start.Y;
         this.startX = start.X;
         this.endY = end.Y;
         this.endX = end.X;
     }
     else
     {
         this.endY = start.Y;
         this.endX = start.X;
         this.startY = end.Y;
         this.startX = end.X;
     }
 }
Пример #3
0
 public bool Contains(Loc l)
 {
     if (IsRectangularSelection)
         return l.X >= (Start.X < End.X ? Start.X : End.X) && l.X < (Start.X > End.X ? Start.X : End.X) && l.Y >= Start.Y && l.Y <= End.Y;
     else
         return (IsSingleLine ? (Start.X <= l.X && End.X >= l.X) : (Start.Y < l.Y && End.Y > l.Y) || (Start.Y == l.Y && Start.X <= l.Y) || (End.Y == l.Y && End.X >= l.Y));
 }
Пример #4
0
 // Constructor
 public Range(int startY, int startX, int endY, int endX, SelectionType type = SelectionType.Normal)
 {
     start = new Loc(startY, startX);
     end = new Loc(endY, endX);
     this.type = type;
 }
Пример #5
0
 public Loc WithOffset(Loc offset)
 {
     return new Loc(y + offset.y, x + offset.x);
 }