aboutsummaryrefslogtreecommitdiff
path: root/mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala
blob: 887c4d6ae4cfca6e96a2ad926c37865e0d444e0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package mavigator
package cockpit

import org.scalajs.dom.html
import scalatags.JsDom.all._

import util._

/** Provides main cockpit layout. */
trait Layout { self: Page with Instruments =>

  /** Elements to display in the mode control pannel (top panel). */
  def mcp = div(id := "mcp")(
    img(src := asset("images/logo-invert.svg"), style:="height: 20px; margin: 5px;"),
    span(`class`:="mode warning")("Demo System"),
    modes
  )

  /** Element to deisplay on heads-up display (main area). */
  def hud = div(id :="hud")(
    attitudeOverlay.element
  )

  val layoutStyle = """
    |#cockpit {
    |    width: 100%;
    |    height: 100%;
    |    display: flex;
    |    flex-direction: column;
    |    justify-content: flex-start;
    |    align-items: stretch;
    |
    |    background-color: pink;
    |}
    |
    |#mcp {
    |    flex: 0 1 0;
    |    background-color: #222222;
    |}
    |
    |#hud {
    |    flex: 1 1 auto;
    |    position: relative;
    |    background-color: lightblue;
    |}""".stripMargin

  override def styles = Seq(layoutStyle) ++ instrumentStyles

  override def elements: Seq[html.Element] = Seq(div(id := "cockpit")(
    mcp,
    hud
  ).render)

}