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

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

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)
  }
  
}