diff -r 0519fdce9a59 -r 99ba78619ffa svghmi/svghmi.js --- a/svghmi/svghmi.js Wed Apr 01 18:10:45 2020 +0200 +++ b/svghmi/svghmi.js Fri Apr 03 08:13:47 2020 +0200 @@ -239,6 +239,13 @@ cache[index] = value; }; +function apply_hmi_value(index, new_val) { + let old_val = cache[index] + if(new_val != undefined && old_val != new_val) + send_hmi_value(index, new_val); + return new_val; +} + function change_hmi_value(index, opstr) { let op = opstr[0]; let given_val = opstr.slice(1); @@ -404,7 +411,6 @@ need_cache_apply.push(this); jumps_need_update = true; requestHMIAnimation(); - console.log(opstr, new_item_offset); } @@ -460,3 +466,24 @@ alert("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+"."); }; + +var edit_callback; +function edit_value(path, valuetype, callback, initial) { + + let [keypadid, xcoord, ycoord] = keypads[valuetype]; + console.log('XXX TODO : Edit value', path, valuetype, callback, initial, keypadid); + edit_callback = callback; + + let [element, parent] = detachable_elements[keypadid]; + tmpgrp = document.createElement("g"); + tmpgrpattr = document.createAttribute("transform"); + + let [xdest,ydest] = page_desc[current_visible_page].bbox; + tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")"; + tmpgrp.setAttributeNode(tmpgrpattr); + + tmpgrp.appendChild(element); + parent.appendChild(tmpgrp); + +}; +