aboutsummaryrefslogtreecommitdiff
path: root/vfd-dashboard/src/main/scala/vfd/dashboard/ui/instruments/Altimeter.scala
blob: 9ff3bb5a5cf463204fc4664232b5ac6d6bf06132 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package vfd.dashboard.ui.instruments

import org.scalajs.dom.html
import vfd.dashboard.Environment

class Altimeter(implicit env: Environment) extends SvgInstrument[Double] {
  import SvgInstrument._

  val initial = 0.0

  lazy val element = svgObject("altimeter")
  lazy val hand = part("hand")
  lazy val moveable = Seq(hand)

  // 36deg === 1m
  protected def update(altitude: Double) = {
    rotate(hand, (altitude * 36).toInt)
  }
}