svghmi/widget_input.ysl2
branchsvghmi
changeset 3188 c173452bf894
parent 3155 99ce78ddd353
child 3232 7bdb766c2a4d
equal deleted inserted replaced
3187:ba8ff21fd82b 3188:c173452bf894
     8          }
     8          }
     9          edit_callback(new_val) {
     9          edit_callback(new_val) {
    10              this.apply_hmi_value(0, new_val);
    10              this.apply_hmi_value(0, new_val);
    11          }
    11          }
    12 
    12 
    13          overshot(new_val, max) {
    13          is_inhibited = false;
    14              this.last_display = "max: "+max;
    14          alert(msg){
       
    15              this.is_inhibited = true;
       
    16              this.display = msg;
       
    17              setTimeout(() => this.stopalert(), 1000);
    15              this.request_animate();
    18              this.request_animate();
    16          }
    19          }
    17 
    20 
       
    21          stopalert(){
       
    22              this.is_inhibited = false;
       
    23              this.display = this.last_value;
       
    24              this.request_animate();
       
    25          }
       
    26 
       
    27          overshot(new_val, max) {
       
    28              this.alert("max");
       
    29          }
       
    30 
    18          undershot(new_val, min) {
    31          undershot(new_val, min) {
    19              this.last_display = "min: "+min;
    32              this.alert("min");
    20              this.request_animate();
       
    21          }
    33          }
    22 
    34 
    23 
    35 
    24     }
    36     }
    25 ||
    37 ||
    43 
    55 
    44 
    56 
    45     if "$have_value or $have_edit" {
    57     if "$have_value or $have_edit" {
    46         choose{
    58         choose{
    47             when "count(arg) = 1" {
    59             when "count(arg) = 1" {
    48     |         this.last_display = vsprintf("«arg[1]/@value»", [value]);
    60     |         this.last_value = vsprintf("«arg[1]/@value»", [value]);
    49             }
    61             }
    50             otherwise {
    62             otherwise {
    51     |         this.last_display = value;
    63     |         this.last_value = value;
    52             }
    64             }
    53         }
    65         }
       
    66     |         if(!this.is_inhibited){
       
    67     |             this.display = this.last_value;
       
    68     if "$have_value" {
       
    69     |             this.request_animate();
    54     }
    70     }
    55     if "$have_value" {
    71     |         }
    56     |         this.request_animate();
       
    57     }
    72     }
    58     |     },
    73     |     },
    59 
    74 
    60     if "$have_value" {
    75     if "$have_value" {
    61     |     animate: function(){
    76     |     animate: function(){
    62     |         this.value_elt.textContent = String(this.last_display);
    77     |         this.value_elt.textContent = String(this.display);
    63     |     },
    78     |     },
    64     }
    79     }
    65 
    80 
    66     |     init: function() {
    81     |     init: function() {
    67 
    82 
    68     if "$have_edit" {
    83     if "$have_edit" {
    69     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_display);
    84     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
    70         if "$have_value" {
    85         if "$have_value" {
    71     |         this.value_elt.style.pointerEvents = "none";
    86     |         this.value_elt.style.pointerEvents = "none";
    72         }
    87         }
    73     }
    88     }
    74 
    89