diff options
Diffstat (limited to 'vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala')
-rw-r--r-- | vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala b/vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala index 4c17ecf..f911865 100644 --- a/vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala +++ b/vfd-frontend/src/main/scala/vfd/frontend/ui/Components.scala @@ -75,7 +75,7 @@ object Components { frame(inst, size) } - def basic(value: Rx[Double], size: String)(implicit app: Environment) = { + def basic(value: Rx[Double], size: String)(implicit app: Environment) = { val inst = instrument("basic") Obs(value, skipInitial = true) { val svg = inst.contentDocument @@ -87,6 +87,19 @@ object Components { } frame(inst, size) } + + def bar(value: Rx[Double], size: String)(implicit app: Environment) = { + val inst = instrument("bar") + Obs(value, skipInitial = true) { + val svg = inst.contentDocument + val level = svg.getElementById("level") + level.style.transform = "translate(0px, " + 97 * (1 - value() / 100) + "px)"; + level.style.transition = "transform 250ms ease-out" + svg.getElementById("unit").textContent = "%" + svg.getElementById("value").textContent = value().toString + } + frame(inst, size) + } } |