equal
deleted
inserted
replaced
371 | this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] |
371 | this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] |
372 | this.origin = this.needle_elt.getPointAtLength(0); |
372 | this.origin = this.needle_elt.getPointAtLength(0); |
373 | }, |
373 | }, |
374 } |
374 } |
375 |
375 |
|
376 def "func:escape_quotes" { |
|
377 param "txt"; |
|
378 // have to use a python string to enter escaped quote |
|
379 const "frst", !"substring-before($txt,'\"')"!; |
|
380 const "frstln", "string-length($frst)"; |
|
381 choose { |
|
382 when "$frstln > 0 and string-length($txt) > $frstln" { |
|
383 result !"concat($frst,'\\\"',func:escape_quotes(substring-after($txt,'\"')))"!; |
|
384 } |
|
385 otherwise { |
|
386 result "$txt"; |
|
387 } |
|
388 } |
|
389 } |
|
390 |
376 template "widget[@type='Input']", mode="widget_defs" { |
391 template "widget[@type='Input']", mode="widget_defs" { |
377 param "hmi_element"; |
392 param "hmi_element"; |
378 | frequency: 5, |
393 | frequency: 5, |
379 labels("value"); |
394 labels("value"); |
380 | dispatch: function(value) { |
395 | dispatch: function(value) { |
385 if "$edit_elt_id" { |
400 if "$edit_elt_id" { |
386 | document.getElementById("«$edit_elt_id»").addEventListener( |
401 | document.getElementById("«$edit_elt_id»").addEventListener( |
387 | "click", |
402 | "click", |
388 | evt => alert('XXX TODO : Edit value')); |
403 | evt => alert('XXX TODO : Edit value')); |
389 } |
404 } |
390 foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-][0-9]+')]" { |
405 foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" { |
391 | document.getElementById("«@id»").addEventListener( |
406 | document.getElementById("«@id»").addEventListener( |
392 | "click", |
407 | "click", |
393 | evt => {let new_val = change_hmi_value(this.indexes[0], "«@inkscape:label»"); |
408 | evt => {let new_val = change_hmi_value(this.indexes[0], "«func:escape_quotes(@inkscape:label)»"); |
394 | this.value_elt.textContent = String(new_val);}); |
409 | this.value_elt.textContent = String(new_val);}); |
395 /* could gray out value until refreshed */ |
410 /* could gray out value until refreshed */ |
396 } |
411 } |
397 | }, |
412 | }, |
398 } |
413 } |