getCorrectGlyph method

int getCorrectGlyph(
  1. bool left,
  2. bool top,
  3. bool right,
  4. bool bottom,
)

Implementation

int getCorrectGlyph(bool left, bool top, bool right, bool bottom) =>
    switch ((left, top, right, bottom)) {
      // Horizontal
      (true, false, true, false) => horizontalLine,
      // Vertical
      (false, true, false, true) => verticalLine,
      // Corners
      (true, true, false, false) => bottomRightCorner,
      (false, true, true, false) => bottomLeftCorner,
      (true, false, false, true) => topRightCorner,
      (false, false, true, true) => topLeftCorner,
      // Crosses / tees
      (true, true, true, true) => cross,
      (true, false, true, true) => teeDown,
      (true, true, true, false) => teeUp,
      (false, true, true, true) => teeRight,
      (true, true, false, true) => teeLeft,
      // Single connections (fallback)
      (true, false, false, false) => horizontalLine,
      (false, true, false, false) => verticalLine,
      (false, false, true, false) => horizontalLine,
      (false, false, false, true) => verticalLine,
      // No lines (Not possible)
      (false, false, false, false) => throw UnimplementedError(),
    };