--- a/svghmi/widgets_common.ysl2 Mon Aug 10 11:30:06 2020 +0200
+++ b/svghmi/widgets_common.ysl2 Mon Aug 10 13:58:55 2020 +0200
@@ -64,10 +64,14 @@
emit "preamble:widget-base-class" {
||
+ var pending_widget_animates = [];
+
class Widget {
offset = 0;
frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
unsubscribable = false;
+ pending_animate = false;
+
constructor(elt_id,args,indexes,members){
this.element_id = elt_id;
this.element = id(elt_id);
@@ -152,6 +156,20 @@
console.log(err);
}
}
+
+ _animate(){
+ this.animate();
+ this.pending_animate = false;
+ }
+
+ request_animate(){
+ if(!this.pending_animate){
+ pending_widget_animates.push(this);
+ this.pending_animate = true;
+ requestHMIAnimation();
+ }
+
+ }
}
||
}