diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-02-27 17:11:10 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-04-14 04:03:17 -0700 |
commit | dae336ee5514970fee93b0db25ce272ab83bd3c7 (patch) | |
tree | a628a7c02c6956d99510d98f2a0321be00b241bf /mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala | |
parent | 773bc081728bf770281a22c1700d05b1def75542 (diff) | |
download | mavigator-dae336ee5514970fee93b0db25ce272ab83bd3c7.tar.gz mavigator-dae336ee5514970fee93b0db25ce272ab83bd3c7.tar.bz2 mavigator-dae336ee5514970fee93b0db25ce272ab83bd3c7.zip |
Refactor UI to a HUD-style interface
Diffstat (limited to 'mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala')
-rw-r--r-- | mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala b/mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala new file mode 100644 index 0000000..887c4d6 --- /dev/null +++ b/mavigator-cockpit/src/main/scala/mavigator/cockpit/Layout.scala @@ -0,0 +1,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) + +} |