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

import mavigator.util.Environment
import org.scalajs.dom.html
import rx._

class Bar(val value: Rx[Double])(implicit env: Environment) extends SvgInstrument[Double] {
  import SvgInstrument._
  
  lazy val element = svgObject("bar")
  lazy val level = part("level")
  lazy val moveable = Seq(level)
  
  protected def update(value: Double) = {
    translate(level, 0, (97 * (1 - value / 100)).toInt)
  }
  
}