def drawColumn()

in app/thumbnails/ContainerThumbnails.scala [86:173]


  def drawColumn(
      column: Column,
      x: Double,
      y: Double,
      width: Double,
      height: Double
  ) = {
    def box = <rect x={x.toString} y={y.toString} width={
      width.toString
    } height={height.toString} style={Style} />

    def image(itemClasses: ItemClasses) =
      drawImage(x, y, width, height, itemClasses)

    column match {
      case SingleItem(_, itemClasses) =>
        <g>
          {box}
          {image(itemClasses)}
        </g>

      case Rows(_, columns, rows, itemClasses) =>
        val rowWidth = width / columns.toDouble
        val rowHeight = height / rows.toDouble

        for {
          col <- 0 until columns
          row <- 0 until rows
        } yield {
          val left = x + col * rowWidth
          val top = y + row * rowHeight

          <g>
            <rect x={left.toString}
                  y={top.toString}
                  width={rowWidth.toString}
                  height={rowHeight.toString}
                  style={Style}/>
            {drawImage(left, top, rowWidth, rowHeight, itemClasses)}
          </g>
        }

      case _: MPU =>
        val centreX = x + width / 2
        val centreY = y + height / 2

        <g>
          {box}
          <text x={centreX.toString}
                y={centreY.toString}
                text-anchor="middle"
                style="font: 10px Arial, Verdana, sans-serif; alignment-baseline: central; fill: white;">MPU</text>
        </g>

      case SplitColumn(_, _, topItemClasses, _, bottomItemClasses) =>
        val centreY = y + height / 2

        <g>
          <rect x={x.toString}
                y={y.toString}
                width={width.toString}
                height={(height / 2).toString}
                style={Style} />
          {drawImage(x, y, width, height / 2, topItemClasses)}
          <rect x={x.toString}
                y={centreY.toString}
                width={width.toString}
                height={(height / 4).toString}
                style={Style} />
          {drawImage(x, centreY, width, height / 4, bottomItemClasses)}
          <rect x={x.toString}
                y={(centreY + height / 4).toString}
                width={width.toString}
                height={(height / 4).toString}
                style={Style} />
          {
          drawImage(
            x,
            centreY + height / 4,
            width,
            height / 4,
            bottomItemClasses
          )
        }
        </g>

    }
  }