svghmi/widget_input.ysl2
changeset 3538 d6c9da8d594e
parent 3536 4ee33be5b8b6
child 3706 39ae17a1cabe
equal deleted inserted replaced
3537:cb7db021280c 3538:d6c9da8d594e
    63 
    63 
    64     const "edit_elt" optional_labels("edit");
    64     const "edit_elt" optional_labels("edit");
    65     const "have_edit","string-length($edit_elt)>0";
    65     const "have_edit","string-length($edit_elt)>0";
    66     value "$edit_elt";
    66     value "$edit_elt";
    67 
    67 
       
    68     const "action_elements", "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]";
       
    69 
    68     if "$have_value"
    70     if "$have_value"
    69     |     frequency: 5,
    71     |     frequency: 5,
    70     |     dispatch: function(value) {
    72     |     dispatch: function(value) {
    71 
    73 
    72 
    74 
    92     |     animate: function(){
    94     |     animate: function(){
    93     |         this.value_elt.textContent = String(this.display);
    95     |         this.value_elt.textContent = String(this.display);
    94     |     },
    96     |     },
    95     }
    97     }
    96 
    98 
       
    99     foreach "$action_elements" {
       
   100     |     action_elt_«position()»: id("«@id»"),
       
   101     }
    97     |     init: function() {
   102     |     init: function() {
    98 
   103 
    99     if "$have_edit" {
   104     if "$have_edit" {
   100     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
   105     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
   101         if "$have_value" {
   106         if "$have_value" {
   102     |         this.value_elt.style.pointerEvents = "none";
   107     |         this.value_elt.style.pointerEvents = "none";
   103         }
   108         }
   104     |         this.animate();
   109     |         this.animate();
   105     }
   110     }
   106 
   111 
   107     foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
   112     foreach "$action_elements" {
   108     |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
   113     |         this.action_elt_«position()».onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
   109     }
   114     }
   110 
   115 
   111     if "$have_value" {
   116     if "$have_value" {
   112     |         this.value_elt.textContent = "";
   117     |         this.value_elt.textContent = "";
   113     }
   118     }