svghmi/widget_input.ysl2
changeset 3523 13282f91e6ff
parent 3241 fe945f1f48b7
child 3536 4ee33be5b8b6
equal deleted inserted replaced
3522:f3a14422d56e 3523:13282f91e6ff
    49      }
    49      }
    50 
    50 
    51      undershot(new_val, min) {
    51      undershot(new_val, min) {
    52          this.alert("min");
    52          this.alert("min");
    53      }
    53      }
       
    54 
       
    55      display = "";
    54 ||
    56 ||
    55 
    57 
    56 widget_defs("Input") {
    58 widget_defs("Input") {
    57 
    59 
    58     const "value_elt" optional_labels("value");
    60     const "value_elt" optional_labels("value");
    63     const "have_edit","string-length($edit_elt)>0";
    65     const "have_edit","string-length($edit_elt)>0";
    64     value "$edit_elt";
    66     value "$edit_elt";
    65 
    67 
    66     if "$have_value"
    68     if "$have_value"
    67     |     frequency: 5,
    69     |     frequency: 5,
    68 
       
    69     |     dispatch: function(value) {
    70     |     dispatch: function(value) {
    70 
    71 
    71 
    72 
    72     if "$have_value or $have_edit" {
    73     if "$have_value or $have_edit" {
    73         choose{
    74         choose{
    98     if "$have_edit" {
    99     if "$have_edit" {
    99     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
   100     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
   100         if "$have_value" {
   101         if "$have_value" {
   101     |         this.value_elt.style.pointerEvents = "none";
   102     |         this.value_elt.style.pointerEvents = "none";
   102         }
   103         }
       
   104     |         this.animate();
   103     }
   105     }
   104 
   106 
   105     foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
   107     foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
   106     |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
   108     |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
   107     }
   109     }
   108 
   110 
       
   111     if "$have_value" {
       
   112     |         this.value_elt.textContent = "";
       
   113     }
   109     |     },
   114     |     },
   110 }
   115 }