cursorRect function

Rect cursorRect(
  1. int shape,
  2. double cellWidth,
  3. double cellHeight,
  4. double lineWidth,
)

Cursor rect for shape (0 block, 1 underline, 2 beam, 3 hollow) at cell origin.

Implementation

Rect cursorRect(int shape, double cellWidth, double cellHeight, double lineWidth) {
  switch (shape) {
    case 2: // beam
      return Rect.fromLTWH(0, 0, lineWidth * 2, cellHeight);
    case 1: // underline
      return Rect.fromLTWH(0, cellHeight - lineWidth * 2, cellWidth, lineWidth * 2);
    default: // block (0) and hollow (3) use the full cell
      return Rect.fromLTWH(0, 0, cellWidth, cellHeight);
  }
}