# HG changeset patch # User Edouard Tisserant # Date 1585813133 -7200 # Node ID 1a1caf71b1cc34401feb03ae9adeab99bc20b46b # Parent 01352aca1caee755c4c04d72c4290757f6920e7f SVGHMI: Widget input buttons should be clickable through svg:use (onclick attribute instead of addEventListener) diff -r 01352aca1cae -r 1a1caf71b1cc svghmi/widget_input.ysl2 --- a/svghmi/widget_input.ysl2 Wed Apr 01 14:42:50 2020 +0200 +++ b/svghmi/widget_input.ysl2 Thu Apr 02 09:38:53 2020 +0200 @@ -24,14 +24,14 @@ | evt => alert('XXX TODO : Edit value')); } foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" { - | id("«@id»").addEventListener( - | "click", - | evt => {let new_val = change_hmi_value(this.indexes[0], "«func:escape_quotes(@inkscape:label)»"); - if "$have_value"{ - | this.value_elt.textContent = String(new_val); - } - | }); - /* TODO gray out value until refreshed */ + | id("«@id»").setAttribute("onclick", "hmi_widgets['«$hmi_element/@id»'].on_op_click('«func:escape_quotes(@inkscape:label)»')"); } | }, + | on_op_click: function(opstr) { + | let new_val = change_hmi_value(this.indexes[0], opstr); + if "$have_value"{ + | this.value_elt.textContent = String(new_val); + /* TODO gray out value until refreshed */ + } + | }, }