svghmi/widgets_common.ysl2
branchsvghmi
changeset 3019 497aac6522a3
parent 3007 360300a8b995
child 3024 0a9f6f29b7dd
equal deleted inserted replaced
3018:22b969b409b0 3019:497aac6522a3
    62     }
    62     }
    63 }
    63 }
    64 
    64 
    65 emit "preamble:widget-base-class" {
    65 emit "preamble:widget-base-class" {
    66     ||    
    66     ||    
       
    67     var pending_widget_animates = [];
       
    68 
    67     class Widget {
    69     class Widget {
    68         offset = 0;
    70         offset = 0;
    69         frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
    71         frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
    70         unsubscribable = false;
    72         unsubscribable = false;
       
    73         pending_animate = false;
       
    74 
    71         constructor(elt_id,args,indexes,members){
    75         constructor(elt_id,args,indexes,members){
    72             this.element_id = elt_id;
    76             this.element_id = elt_id;
    73             this.element = id(elt_id);
    77             this.element = id(elt_id);
    74             this.args = args;
    78             this.args = args;
    75             this.indexes = indexes;
    79             this.indexes = indexes;
   149                     }
   153                     }
   150                 }
   154                 }
   151             } catch(err) {
   155             } catch(err) {
   152                 console.log(err);
   156                 console.log(err);
   153             }
   157             }
       
   158         }
       
   159         
       
   160         _animate(){
       
   161             this.animate();
       
   162             this.pending_animate = false;
       
   163         }
       
   164 
       
   165         request_animate(){
       
   166             if(!this.pending_animate){
       
   167                 pending_widget_animates.push(this);
       
   168                 this.pending_animate = true;
       
   169                 requestHMIAnimation();
       
   170             }
       
   171 
   154         }
   172         }
   155     }
   173     }
   156     ||
   174     ||
   157 }
   175 }
   158 
   176